private static void ConfigureApplication(string instrumentationKey, TelemetryClient client, TelemetryConfiguration config, TelemetryInitializer initializer) { config.InstrumentationKey = instrumentationKey; config.TelemetryInitializers.Add(initializer); Application.ThreadException += (s, e) => { client.TrackException(new ExceptionTelemetry(e.Exception) { HandledAt = ExceptionHandledAt.Unhandled, SeverityLevel = SeverityLevel.Critical, }); throw e.Exception; }; Application.ApplicationExit += (s, e) => { client.Flush(); }; }
private static void ConfigureApplication(string instrumentationKey, TelemetryClient client, TelemetryConfiguration config, TelemetryInitializer initializer) { config.InstrumentationKey = instrumentationKey; config.ContextInitializers.Add(initializer); Application.ThreadException += (s, e) => { client.TrackException(new ExceptionTelemetry(e.Exception) { HandledAt = ExceptionHandledAt.Unhandled, SeverityLevel = SeverityLevel.Critical, }); throw e.Exception; }; Application.ApplicationExit += (s, e) => { client.Flush(); }; }