c# - Application Insights: How to track crashes in Desktop (WPF) applications? -
i'm using application insights wpf application. tracking of pageviews , custom events working.
now track crashes. idea to:
private void appdispatcherunhandledexception(object sender, dispatcherunhandledexceptioneventargs e) { telemetryclient.trackexception(e.exception); telemetryclient.flush(); }
the code called when unhandled exception occurs not shown "crash" in application insights portal. have read somewhere trackexception not count "crash" when application not crash.
desktop (e.g. wpf) applications must use low level api of application insights. have not found way tell application insights wpf application crashing.
how that?
for wpf applications, there no inherent support capturing crashes. statement "the code called when unhandled exception occurs not shown "crash" in application insights portal. have read somewhere trackexception not count "crash" when application not crash." - true.
here documentation describing it.
if still want treat exceptions handling treated crashes, 1 way can treating tracked exception unhandled.
here how -
var exceptiontelemetry = new microsoft.applicationinsights.datacontracts.exceptiontelemetry(new exception()); exceptiontelemetry.handledat = microsoft.applicationinsights.datacontracts.exceptionhandledat.unhandled; telemetryclient.trackexception(exceptiontelemetry);
Comments
Post a Comment