The Exception class allows us to add custom data using exception.Data.Add("label", "value"). It would be useful if this data could show up in Application Insights.
Using telemetry.TrackException() we can report custom data in a very similar way as a Dictionary<string,string>, so hopefully it wouldn't be much work to support exception.Data.Add().
The advantage would be that the custom data would be supported for exceptions that are caught and rethrown, as well as those using telemetary.TrackException().
Iain Shepherd (ishepher) commented
I raised this at https://github.com/microsoft/ApplicationInsights-dotnet/issues/1932
Simon Vane (svane) commented
This would be a great help. There is sometimes quite a lot of additional data that can be useful for diagnosis.
It would be interesting to be able to correlating some metadata with telemetry through Exception.Data dictionary.
I've tried with TelemetryClient.Context.GlobalProperties but I have to use a lock for concurrency issues in this dictionary. These properties are for global data purposes, but I'd need something specific for each exception.