Hi Folks
Trying to create an exception handler that will update Azure Application Insights when hit. I’ve tried two different types of Invoke Codes but neither are appearing in Application Insights.
I have no experience in using Azure Application Insights so I’m hoping that I am either missing a permission to be set or something is missing from the code.
“in_key” refers to the Instrumentation Key
C# Attempt
// Create a new instance of TelemetryConfiguration
Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration configuration = Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.CreateDefault();
// Set the instrumentation key for your Azure Insights instance
configuration.InstrumentationKey = in_key;
// Create a new instance of TelemetryClient with the configuration
Microsoft.ApplicationInsights.TelemetryClient telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient(configuration);
//Send Exception
telemetryClient.TrackException(in_exception);
VB.Net Attempt
Dim telemetryClient As New Microsoft.ApplicationInsights.TelemetryClient
telemetryClient.InstrumentationKey = in_key
Dim exceptionTelemetry As New Microsoft.ApplicationInsights.DataContracts.ExceptionTelemetry(in_exception)
exceptionTelemetry.Properties.Add("AdditionalProperty1", "Value1")
exceptionTelemetry.Properties.Add("AdditionalProperty2", "Value2")
telemetryClient.TrackException(exceptionTelemetry)