void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { ExceptionDetails exception = new ExceptionDetails(e.Exception); exception.ShowDialog(); exception = null; e.Handled = true; }
public static string SearchForFirst(string directory, string searchPattern, string[] extensions) { try { var directoryInfo = new DirectoryInfo(directory); var result = directoryInfo.GetFilesWithExtensions(searchPattern, SearchOption.TopDirectoryOnly, extensions); if (result.Length > 0) { return(result[0].FullName); } var subdirectories = Directory.GetDirectories(directory); for (var i = 0; i < subdirectories.Length; i++) { var found = SearchForFirst(subdirectories[i], searchPattern, extensions); if (found != null) { return(found); } } } catch (Exception ex) { Console.Error.WriteLine(ExceptionDetails.Get(ex)); } return(null); }
public async Task <ActionResult> Statement(string id) { try { var directory = await GetDirectoryAsync(); var model = new StatementList(directory); model.Users = userBusinessLogic.Find(" "); model.CurrentUser = CurrentUser; model.Roles = Role.Roles; // userBusinessLogic.Role_GetList(); if (!string.IsNullOrEmpty(id)) { model.Statement = statementBusinessLogic.Statement_Get(Convert.ToInt64(id)); model.Status = new StatementStatus(); model.File = new Entities.File(); model.Execution = new Execution(); } else { model.Statement = new Statement(); model.Status = new StatementStatus(); model.File = new Entities.File(); model.Execution = new Execution(); } return(View(model)); } catch (Exception ex) { var exceptionDetails = new ExceptionDetails(ex, "Ошибка при загрузке обращения."); var model = new StatementList(exceptionDetails); return(View(model)); } }
private static void ConvertExceptionTree(Exception exception, ExceptionDetails parentExceptionDetails, List <ExceptionDetails> exceptions) { if (exception == null) { exception = new Exception(Utils.PopulateRequiredStringValue(null, "message", typeof(ExceptionTelemetry).FullName)); } ExceptionDetails exceptionDetails = PlatformSingleton.Current.GetExceptionDetails(exception, parentExceptionDetails); exceptions.Add(exceptionDetails); AggregateException aggregate = exception as AggregateException; if (aggregate != null) { foreach (Exception inner in aggregate.InnerExceptions) { ConvertExceptionTree(inner, exceptionDetails, exceptions); } } else if (exception.InnerException != null) { ConvertExceptionTree(exception.InnerException, exceptionDetails, exceptions); } }
public JsonResult SaveStatementAll(Statement item) { ////Для примера //item.Validate(new ModelValidationContext()); //if (item.IsValid()) //{ // //если все нормально - то сохраняем //} //else //{ // var listError = item.Messages; // //return Json(listError); //} try { var result = statementBusinessLogic.Statement_SaveAll(item); item.Id = result; Notification.SendEmailChangeStatus(item); return(Json(new { StatementID = result })); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; var exceptionDetails = new ExceptionDetails(ex, "Ошибка при сохранении обращения."); return(Json(exceptionDetails)); } }
public JsonResult SaveFile(Entities.File item) { if (Request.Files == null || Request.Files.Count < 1) { throw new Exception("Выберите файл для загрузки"); } try { //сохраняем на диск HttpPostedFileBase upload = Request.Files[0]; string filename = Guid.NewGuid().ToString() + Path.GetExtension(upload.FileName); string path = Path.Combine(ConfiguraionProvider.FileStorageFolder, filename); upload.SaveAs(path); //дозаполняем данными item.AttachmentDate = DateTime.Now; item.UserID = CurrentUser.Id; item.FileName = Request.Files[0].FileName; //оригинальное название файла item.FIleUrl = Path.Combine(filename); //имя, как мы его сохраняем //сохраняем в БД List <Entities.File> files = new List <Entities.File>() { item }; var result = statementBusinessLogic.File_Save(files); return(Json(result)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; var exceptionDetails = new ExceptionDetails(ex, "Ошибка при сохранении файла(-ов)."); return(Json(exceptionDetails)); } }
public ExceptionInfoResponseBody(string exceptionId, ExceptionBreakMode breakMode, string description = null, ExceptionDetails details = null) { this.ExceptionId = exceptionId; this.BreakMode = breakMode; this.Description = description; this.Details = details; }
public void TestInnerException(string caller_trace, int innerLevel, string excName, string excMessage) { ExceptionInfoRequest exceptionInfoRequest = new ExceptionInfoRequest(); exceptionInfoRequest.arguments.threadId = threadId; var ret = VSCodeDebugger.Request(exceptionInfoRequest); Assert.True(ret.Success, @"__FILE__:__LINE__" + "\n" + caller_trace); ExceptionInfoResponse exceptionInfoResponse = JsonConvert.DeserializeObject <ExceptionInfoResponse>(ret.ResponseStr); ExceptionDetails exceptionDetails = exceptionInfoResponse.body.details.innerException[0]; for (int i = 0; i < innerLevel; ++i) { exceptionDetails = exceptionDetails.innerException[0]; } if (exceptionDetails.fullTypeName == excName && exceptionDetails.message == excMessage) { return; } throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace); }
private void ConvertExceptionTree(Exception exception, ExceptionDetails parentExceptionDetails, List <ExceptionDetails> exceptions) { if (exception == null) { exception = new Exception(Utils.PopulateRequiredStringValue(null, "message", typeof(ExceptionTelemetry).FullName)); } ExceptionDetails exceptionDetails = ExceptionConverter.ConvertToExceptionDetails(exception, parentExceptionDetails); // For upper level exception see if Message was provided and do not use exceptiom.message in that case if (parentExceptionDetails == null && !string.IsNullOrWhiteSpace(this.Message)) { exceptionDetails.message = this.Message; } exceptions.Add(exceptionDetails); AggregateException aggregate = exception as AggregateException; if (aggregate != null) { foreach (Exception inner in aggregate.InnerExceptions) { this.ConvertExceptionTree(inner, exceptionDetails, exceptions); } } else if (exception.InnerException != null) { this.ConvertExceptionTree(exception.InnerException, exceptionDetails, exceptions); } }
public XamlErrorTagger( ITableManagerProvider tableManagerProvider, ITextBuffer buffer, ITextStructureNavigator navigator, PreviewerProcess process) { ThreadHelper.ThrowIfNotOnUIThread(); _buffer = buffer; _navigator = navigator; _process = process; _process.ErrorChanged += HandleErrorChanged; _error = process.Error; // Get the document path and containing project name. var document = GetDocument(buffer); _path = document?.FilePath; _projectName = GetProject(_path)?.Name; // Register ourselves with the error list. var tableManager = tableManagerProvider.GetTableManager(StandardTables.ErrorsTable); tableManager.AddSource(this, StandardTableColumnDefinitions.Column, StandardTableColumnDefinitions.DocumentName, StandardTableColumnDefinitions.ErrorSeverity, StandardTableColumnDefinitions.Line, StandardTableColumnDefinitions.Text); }
public ErrorDetails(ExceptionDetails detail) { Raw = detail.Error.ToString(); Message = detail.ErrorMessage ?? detail.Error.Message; Type = TypeNameHelper.GetTypeDisplayName(detail.Error.GetType()); StackFrames = GetStackFrames(detail.StackFrames).ToList(); }
public void ShowException(ExceptionDetails exception) { var model = exceptionDetail(); model.Exception = exception; windowManager.ShowDialog(model); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { // If development, enable Hot Module Replacement // If production, enable Brotli/Gzip response compression & strict transport security headers if (env.IsDevelopment()) { app.UseDeveloperExceptionPage() .UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true }); } else { app.UseResponseCompression(); app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } // Global exception handling app.UseExceptionHandler(builder => { builder.Run(async context => { var error = context.Features.Get <IExceptionHandlerFeature>(); var exDetails = new ExceptionDetails((int)HttpStatusCode.InternalServerError, error?.Error.Message); context.Response.ContentType = "application/json"; context.Response.StatusCode = exDetails.StatusCode; context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); context.Response.Headers.Add("Application-Error", exDetails.Message); context.Response.Headers.Add("Access-Control-Expose-Headers", "Application-Error"); await context.Response.WriteAsync(exDetails.ToString()); }); }); // Enable all custom health checks registered earlier (browse to {url}/healthchecks-ui to UI / {url}/healthchecks-json to raw JSON) app.UseApiHealthChecks("/healthchecks-json") .UseHealthChecksUI(); // Register the Swagger generator and the Swagger UI middlewares // NSwage.MsBuild + adding automation config in GhostUI.csproj makes this part of the build step (updates to API will be handled automatically) app.UseSwaggerUi3(settings => { settings.Path = "/docs"; settings.DocumentPath = "/docs/api-specification.json"; }); app.UseCors("AllowAll") .UseDefaultFiles() .UseStaticFiles() .UseSignalR((options) => options.MapHub <UsersHub>("/hubs/users")) .UseMvc(routes => { routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}") .MapSpaFallbackRoute("spa-fallback", new { controller = "Home", action = "Index" }); }); }
public ErrorDetails(EnvironmentDetails environmentDetails, ExceptionHandlingDetails exceptionHandlingDetails, ExceptionDetails exceptionDetails, string faultingContextDetails, string programName) { EnvironmentDetails = environmentDetails; ExceptionHandlingDetails = exceptionHandlingDetails; ExceptionDetails = exceptionDetails; FaultingContextDetails = faultingContextDetails; ProgramName = programName; }
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { ExceptionDetails exception = new ExceptionDetails(e.Exception); exception.ShowDialog(); exception = null; e.Handled = true; }
internal PostcodeNLException(ExceptionDetails exceptionDetails, Uri uri, HttpResponseMessage httpResponseMessage, Exception innerException) : base(exceptionDetails.Exception, innerException) { ExceptionId = exceptionDetails.ExceptionId; RequestId = exceptionDetails.RequestId; HttpResponseMessage = httpResponseMessage; Uri = uri; }
public XamlErrorTableEntry( string projectName, string path, ExceptionDetails error) { _projectName = projectName; _fileName = path; _error = error; }
public TractoException(Exception exception, HttpContextBase context) { if (exception == null) { throw new ArgumentNullException(nameof(exception)); } _exceptionDetails = new ExceptionDetails(exception.GetBaseException()); }
public void AllStackFramesAreConvertedIfSizeOfParsedStackIsLessOrEqualToMaximum() { var exp = this.CreateException(42); ExceptionDetails expDetails = ExceptionConverter.ConvertToExceptionDetails(exp, null); Assert.Equal(43, expDetails.parsedStack.Count); Assert.True(expDetails.hasFullStack); }
/// <summary> /// Converts a System.Exception to a Coding4Fun.VisualStudio.ApplicationInsights.Extensibility.Implementation.TelemetryTypes.ExceptionDetails. /// </summary> /// <returns></returns> internal static ExceptionDetails ConvertToExceptionDetails(Exception exception, ExceptionDetails parentExceptionDetails) { ExceptionDetails exceptionDetails = ExceptionDetails.CreateWithoutStackInfo(exception, parentExceptionDetails); Tuple <List <Coding4Fun.VisualStudio.ApplicationInsights.Extensibility.Implementation.External.StackFrame>, bool> tuple = SanitizeStackFrame(new StackTrace(exception, true).GetFrames(), GetStackFrame, GetStackFrameLength); exceptionDetails.parsedStack = tuple.Item1; exceptionDetails.hasFullStack = tuple.Item2; return(exceptionDetails); }
public Task <ExceptionDetails> CreateAsync(ExceptionDetails exception) { Ensure.NotNull(exception); return(api.PostAsync <ExceptionDetails>( path: $"/exceptions", data: exception )); }
public DecoratorDeadLetteredEventItem( DecoratorEventItem eventItem, string processorName, string instanceName, string projectionKeyName, ExceptionDetails exception) : base(eventItem, processorName, instanceName, projectionKeyName, exception) { }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHttpsRedirection(); app.UseHsts(); } app.UseExceptionHandler(builder => { builder.Run(async context => { var error = context.Features.Get <IExceptionHandlerFeature>(); var exDetails = new ExceptionDetails((int)HttpStatusCode.InternalServerError, error?.Error.Message); context.Response.ContentType = "application/json"; context.Response.StatusCode = exDetails.StatusCode; context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); context.Response.Headers.Add("Application-Error", exDetails.Message); context.Response.Headers.Add("Access-Control-Expose-Headers", "Application-Error"); await context.Response.WriteAsync(exDetails.ToString()); }); }); app.UseCors(_corsPolicyName); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { spa.Options.SourcePath = _spaSourcePath; if (env.IsDevelopment()) { // Option 1: Run npm process with client app (VueCli - pretty buggy, likely should stick with second option and launch client independently) // spa.Options.StartupTimeout = new TimeSpan(days: 0, hours: 0, minutes: 1, seconds: 30); // spa.UseVueCli(npmScript: "serve", port: 8080); // Option 2: Serve ClientApp independently and proxy requests from ClientApp (baseUri using Vue app port): spa.UseProxyToSpaDevelopmentServer("http://localhost:8080"); } }); }
public ExceptionDetails(Exception exception) { Message = exception.Message; Data = exception.Data; StackTrace = exception.StackTrace.Split(Environment.NewLine) .Select(s => s.Trim()); InnerDetails = exception.InnerException != null ? new ExceptionDetails(exception.InnerException) : null; }
public BaseViewModel(ExceptionDetails exceptionDetails) { var modelState = new CustomObject(); modelState.Add("HasErrors", true); modelState.Add("ErrorMessage", exceptionDetails.Message); modelState.Add("BaseExceptionMessage", exceptionDetails.BaseExceptionMessage); ModelState = modelState.ToExpando(); }
private void RaiseTagsChanged(ExceptionDetails error) { if (error?.LineNumber != null && TagsChanged != null && error.LineNumber.Value < _buffer.CurrentSnapshot.LineCount) { var line = _buffer.CurrentSnapshot.GetLineFromLineNumber(Math.Max(error.LineNumber.Value - 1, 0)); TagsChanged(this, new SnapshotSpanEventArgs(line.Extent)); } }
private T ExtractResult <T>(ExceptionDetails exceptionDetails, RemoteObject remoteObject, bool returnByValue, ExecutionContext context) { CheckException(exceptionDetails); if (returnByValue) { return(DeserializeValue <T>(remoteObject)); } return((T)context.CreateHandle(remoteObject)); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseCors(_corsPolicyName); app.UseExceptionHandler(builder => { builder.Run(async context => { var error = context.Features.Get <IExceptionHandlerFeature>(); var exDetails = new ExceptionDetails((int)HttpStatusCode.InternalServerError, error?.Error.Message); context.Response.ContentType = "application/json"; context.Response.StatusCode = exDetails.StatusCode; context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); context.Response.Headers.Add("Application-Error", exDetails.Message); context.Response.Headers.Add("Access-Control-Expose-Headers", "Application-Error"); await context.Response.WriteAsync(exDetails.ToString()); }); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapControllers(); endpoints.MapDefaultControllerRoute(); //endpoints.MapFallbackToFile("/index.html"); }); app.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; spa.UseProxyToSpaDevelopmentServer("http://localhost:5001"); }); }
// Token: 0x0600069B RID: 1691 RVA: 0x00017FD8 File Offset: 0x000161D8 public RecordProcessingResult(AuditRecord record, Exception exception, bool retry) { this = default(RecordProcessingResult); this.RecordType = record.RecordType; this.FailTime = DateTime.UtcNow; this.RecordId = record.Id; this.Exception = ExceptionDetails.FromException(exception); this.Retry = retry; this.Index = RecordProcessingResult.count++; RecordProcessingResult.count %= 25; }
public void EmptyStringIsReturnedForExceptionWithoutStack() { var exp = new ArgumentException(); ExceptionDetails expDetails = ExceptionConverter.ConvertToExceptionDetails(exp, null); Assert.Equal(string.Empty, expDetails.stack); Assert.Equal(0, expDetails.parsedStack.Count); // hasFullStack defaults to true. Assert.True(expDetails.hasFullStack); }
internal static IExceptionDetails ConvertToExceptionDetails(Exception exception, IExceptionDetails parentExceptionDetails) { IExceptionDetails exceptionDetails = ExceptionDetails.CreateWithoutStackInfo(exception, parentExceptionDetails); var stack = new StackTrace(exception, true); var frames = stack.GetFrames(); Tuple <List <IStackFrame>, bool> sanitizedTuple = SanitizeStackFrame(frames, GetStackFrame, GetStackFrameLength); exceptionDetails.parsedStack = sanitizedTuple.Item1; exceptionDetails.hasFullStack = sanitizedTuple.Item2; return(exceptionDetails); }
protected void ValidateExceptionDetails( ExceptionDetails exceptionDetails0, string expectedTypeName, string expectedMessage, string expectedMethod, string expectedAssembly, int expectedMaxStackPointCount) { Assert.AreEqual(expectedTypeName, exceptionDetails0.TypeName, "exception type 0 name is incorrect"); Assert.AreEqual(expectedMessage, exceptionDetails0.Message, "message 1 is incorrect"); Assert.IsTrue(exceptionDetails0.HasFullStack, "'hasFullStack' for type 0 is incorrect"); Assert.IsTrue(exceptionDetails0.ParsedStack.Count > 0, "no stackpoints"); Assert.IsTrue(exceptionDetails0.ParsedStack.Count <= expectedMaxStackPointCount, "too many stackpoints"); var firstStackPoint = exceptionDetails0.ParsedStack[0]; Assert.AreEqual(0, firstStackPoint.Level, "stackpoint level is incorrect"); Assert.AreEqual(expectedMethod, firstStackPoint.Method, "stackpoint method is incorrect"); Assert.IsTrue(firstStackPoint.Assembly.StartsWith(expectedAssembly), "Assembly name is incorrect"); }
public void ReportTestProgress(string testName, TestStatus status, ExceptionDetails exceptionDetails, string traceDetails) { ServiceController.InvokeCurrentCallback(testName, status, exceptionDetails, traceDetails); }
public ExceptionDetailViewModel(ExceptionDetails exception) { Exception = exception; }
public ExceptionDetailViewModel(ISettingsProvider settingsProvider, ExceptionDetails exception = null) { this.settingsProvider = settingsProvider; DisplayName = "Exception Details"; Exception = exception; }
public ExceptionDetails GetExceptionDetails(Exception exception, ExceptionDetails parentExceptionDetails) { return this.OnGetExceptionDetails(exception, parentExceptionDetails); }
private static void ConvertExceptionTree(Exception exception, ExceptionDetails parentExceptionDetails, List<ExceptionDetails> exceptions) { if (exception == null) { exception = new Exception(Utils.PopulateRequiredStringValue(null, "message", typeof(ExceptionTelemetry).FullName)); } ExceptionDetails exceptionDetails = PlatformSingleton.Current.GetExceptionDetails(exception, parentExceptionDetails); exceptions.Add(exceptionDetails); AggregateException aggregate = exception as AggregateException; if (aggregate != null) { foreach (Exception inner in aggregate.InnerExceptions) { ConvertExceptionTree(inner, exceptionDetails, exceptions); } } else if (exception.InnerException != null) { ConvertExceptionTree(exception.InnerException, exceptionDetails, exceptions); } }
public ExceptionDetails GetExceptionDetails(Exception exception, ExceptionDetails parentExceptionDetails) { throw new NotSupportedException(); }