getsentry/sentry-dotnet

Remove FirstChanceException workaround

jamescrosswell opened this issue · 1 comments

See comment here:

Since the original bug has been fixed, we shouldn't need the workaround anymore.

Coming through a support ticket:

System.NullReferenceException: Object reference not set to an instance of an object.
   at void SentryExceptionExtensions.SetSentryMechanism(Exception ex, string type, string description, bool? handled) in SentryExceptionExtensions.cs:line 38
      ex.Data[Mechanism.MechanismKey] = type;
   at void WinUIUnhandledExceptionIntegration.WinUIUnhandledExceptionHandler(object sender, object e) in WinUIUnhandledExceptionIntegration.cs:line 134
      exception.SetSentryMechanism("Microsoft.UI.Xaml.UnhandledException", description, handled);
   at Delegate EventState.GetEventInvoke()+(object sender, UnhandledExceptionEventArgs e) => { }?
   at int UnhandledExceptionEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)

Since Data is an empty collection by default I suspect the exception itself is null.

ex.Data[Mechanism.MechanismKey] = type;

Going up the callstack we get to this:

// Second part of workaround for https://github.com/microsoft/microsoft-ui-xaml/issues/7160
if (exception.StackTrace is null)
{
exception = _lastFirstChanceException!;
}

Since this workaround now sports a bug we should re-prioritize this.