I've noticed since adding IntelliTrace many exceptions for application insights looking for Microsoft.WindowsAzure.ServiceRunTime.dll when running on a Azure IaaS VM.
//side note
Notably these exceptions didn't appear to be reported in application insights portal, other than sometimes I noticed a high number of exceptions in some graphs but unable to find the exception detail (until using IntelliTrace).... but that could be a red herring as perhaps they are being gobbled by TopShelf.
//end side note
Since researching I understand this dll is infact within the Azure SDK and not a nuget package.
Not wanting to add additional pre-requisites to my service, I favored adding an extension assembly reference and copying to local.
The version was different, looking for 2.5.0.0 so also added a binding redirect to 2.7.0.0
However doing so, now leads to
- Exception Exception thrown: 'System.IO.FileNotFoundException' in Microsoft.WindowsAzure.ServiceRuntime.dll ("Could not load file or assembly 'msshrtmi, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.") System.IO.FileNotFoundException
I'm wary that each time I fix something, I'll need to fix something else, then something else...
Which led me back to my original query... The actual question... :-)
I have not found anything that suggests Application Insights even needs the Azure SDK installed. Which makes me wonder whether the exceptions are actually first chance exceptions where Application Insights is simply inquiring whether the Azure SDK is installed?
For reference, application insights setup:
My Application Insights nuget packages are:
<package id="Microsoft.ApplicationInsights" version="2.5.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.5.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.5.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.5.0" targetFramework="net462" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.5.0" targetFramework="net462" />
And my config includes these TelemetryInitializers:
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
</TelemetryInitializers>
And these TelemetryModules:
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
<ExcludeComponentCorrelationHttpHeadersOnDomains>
<Add>core.windows.net</Add>
<Add>core.chinacloudapi.cn</Add>
<Add>core.cloudapi.de</Add>
<Add>core.usgovcloudapi.net</Add>
<Add>localhost</Add>
<Add>127.0.0.1</Add>
</ExcludeComponentCorrelationHttpHeadersOnDomains>
<IncludeDiagnosticSourceActivities>
<Add>Microsoft.Azure.EventHubs</Add>
<Add>Microsoft.Azure.ServiceBus</Add>
</IncludeDiagnosticSourceActivities>
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer">
</Add>
</TelemetryModules>
The application insights was setup by someone else, I wondered whether one of the extensions was causing trouble, it's for a windows service.
Application Insights itself is hosted in Azure, but the Application Insights SDKs themselves have no dependencies on any Azure SDKs. (you don't need your app to run in azure to send data to Application Insights)
Other things you might be using might have Azure dependencies, but not AI.
If you're looking at website or vm metrics about .net exeptions, that metric is for thrown exceptions across the entire framework. If you aren't seeing the exceptions in the AI portal, that means that they were never handled by AI or tracked by AI.