This is in a Visual Studio Solution with an Asp.Net MVC app targeting .NET Framework 4.6 as the UI project, and several other C# class library projects.
We Application Insights Nuget packages, including the Snapshot Collector package, to all the projects in the solution we wish to trace. All Nuget packages use the latest version.
To trigger a snapshot from code, I throw an exception like so:
try
{
throw new Exception("This is an AI test exception");
}
catch (Exception ex)
{
var ai = new TelemetryClient();
var props = new Dictionary<string, string> { { "Property1", "A test property value" } };
ai.TrackException(ex, props);
}
The MVC Project's ApplicationInsights.config is configured as follows
<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.SnapshotCollector.SnapshotCollectorTelemetryProcessor, Microsoft.ApplicationInsights.SnapshotCollector">
<IsEnabledInDeveloperMode>false</IsEnabledInDeveloperMode>
<HandleUntrackedExceptions>true</HandleUntrackedExceptions>
<ThresholdForSnapshotting>1</ThresholdForSnapshotting>
<ProblemCounterResetInterval>2.00:00:00</ProblemCounterResetInterval> <!--2 days-->
</Add>
</TelemetryProcessors>
I published the app to Azure and invoked the exception several times by browsing the App.
This setup results in the exception being recorded to Application Insights, but without the snapshot. Snapshots work fine for unhandled exceptions.
Shouldn't it take a snapshot after the exception occurs a second time?
Extensions-->Manage Extensions2) reset vs settings underTools-->Import and Export Settings-->Reset all settings3) deletebinandobjfolder. 4) or you could create a new asp net mvc project to test whether the issue happens in the new one. - Mr Qian