MindscapeHQ / raygun4net

Raygun provider for .NET
https://raygun.com
MIT License
126 stars 93 forks source link

Fix nulls in debug info dictionary #535

Closed xenolightning closed 5 months ago

xenolightning commented 5 months ago

There is a possibility that a frame does not have any debugging information attached to it.

This happens when DebugSymbols is set to "None", and the output is in Release mode. The result is DebugInfo but it does not have a signature or other properties.

This addresses that particular scenario, by null checking the debug info as well as the signature before attempting to create the lookup dictionary.

image

image

System.Exception: Really bad explosion
   at MyCoolClassLibrary.AwesomeClass.ThrowsAnException()
   at Program.<Main>$(String[] args)
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'key')
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at Mindscape.Raygun4Net.RaygunErrorMessageBuilder.GetDebugInfoForStackFrames(IEnumerable`1 frames) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\Builders\RaygunErrorMessageBuilder.cs:line 233
   at Mindscape.Raygun4Net.RaygunErrorMessageBuilder.Build(Exception exception) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\Builders\RaygunErrorMessageBuilder.cs:line 204
   at Mindscape.Raygun4Net.RaygunMessageBuilder.SetExceptionDetails(Exception exception) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\Builders\RaygunMessageBuilder.cs:line 54
   at Mindscape.Raygun4Net.RaygunClientBase.BuildMessage(Exception exception, IList`1 tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo, Action`1 customiseMessage) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\RaygunClientBase.cs:line 427
   at Mindscape.Raygun4Net.RaygunClientBase.StripAndSend(Exception exception, IList`1 tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\RaygunClientBase.cs:line 454
   at Mindscape.Raygun4Net.RaygunClientBase.SendAsync(Exception exception, IList`1 tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\RaygunClientBase.cs:line 366
   at Mindscape.Raygun4Net.RaygunClientBase.Send(Exception exception, IList`1 tags, IDictionary userCustomData) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\RaygunClientBase.cs:line 322
   at Mindscape.Raygun4Net.RaygunClientBase.Send(Exception exception) in C:\BuildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\RaygunClientBase.cs:line 295
   at Program.<Main>$(String[] args)
   at Program.<Main>(String[] args)