C# 应用程序洞察:如何跟踪桌面(WPF)应用程序中的崩溃?
我正在为WPF应用程序使用应用程序洞察。页面浏览量和自定义事件的跟踪正在工作 现在我想追踪车祸。我的想法是:C# 应用程序洞察:如何跟踪桌面(WPF)应用程序中的崩溃?,c#,wpf,desktop,azure-application-insights,C#,Wpf,Desktop,Azure Application Insights,我正在为WPF应用程序使用应用程序洞察。页面浏览量和自定义事件的跟踪正在工作 现在我想追踪车祸。我的想法是: private void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { telemetryClient.TrackException(e.Exception); telemetryClient.Flush(); } 当发生未处理
private void AppDispatcherUnhandledException(object sender,
DispatcherUnhandledExceptionEventArgs e)
{
telemetryClient.TrackException(e.Exception);
telemetryClient.Flush();
}
当发生未处理的异常,但在Application Insights门户中未显示为“崩溃”时,将调用该代码。我在某个地方读到,当应用程序没有真正崩溃时,TrackException不算作“崩溃”
桌面(如WPF)应用程序必须使用Application Insights的低级API。我还没有找到一种方法告诉ApplicationInsights WPF应用程序正在崩溃
我该怎么做呢?对于WPF应用程序,没有捕获崩溃的内在支持。您的语句“当发生未处理的异常时调用代码,但在Application Insights门户中未显示为“崩溃”。我在某个地方读到,当应用程序未真正崩溃时,TrackException不算作“崩溃”。-是真的。
是描述它的文档 如果您仍然希望将正在处理的异常视为崩溃,那么可以通过将跟踪的异常视为未处理来实现这一点 这里是如何-
var exceptionTelemetry = new Microsoft.ApplicationInsights.DataContracts.ExceptionTelemetry(new Exception());
exceptionTelemetry.HandledAt = Microsoft.ApplicationInsights.DataContracts.ExceptionHandledAt.Unhandled;
telemetryClient.TrackException(exceptionTelemetry);
异常遥测。在
处处理的异常现在已过时。他们说“使用自定义属性来报告异常处理层”,但我不确定要设置什么样的自定义属性才能让它算作崩溃