Skip to content

Commit

Permalink
chore: Removed FirstChanceException workaround for WinUI (#3411)
Browse files Browse the repository at this point in the history
* removed workaround
* Update CHANGELOG.md

---------

Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
  • Loading branch information
bitsandfoxes and jamescrosswell authored Jul 1, 2024
1 parent bed0f0c commit 79b1dc3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
- Fixed memory leak when tracing is enabled ([#3432](https://github.com/getsentry/sentry-dotnet/pull/3432))
- `Scope.User.Id` now correctly defaults to the InstallationId unless it has been set otherwise ([#3425](https://github.com/getsentry/sentry-dotnet/pull/3425))

### API Changes
- Removed `FirstChanceException` workaround for WinUI ([#3411](https://github.com/getsentry/sentry-dotnet/pull/3411))

### Dependencies

- Bump CLI from v2.31.2 to v2.32.1 ([#3398](https://github.com/getsentry/sentry-dotnet/pull/3398))
Expand Down
10 changes: 0 additions & 10 deletions src/Sentry/Integrations/WinUIUnhandledExceptionIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ internal class WinUIUnhandledExceptionIntegration : ISdkIntegration
private static readonly byte[] WinUIPublicKeyToken = Convert.FromHexString("de31ebe4ad15742b");
private static readonly Assembly? WinUIAssembly = GetWinUIAssembly();

private Exception? _lastFirstChanceException;
private IHub _hub = null!;
private SentryOptions _options = null!;

Expand All @@ -58,9 +57,6 @@ public void Register(IHub hub, SentryOptions options)

// Hook the main event handler
AttachEventHandler();

// First part of workaround for https://github.com/microsoft/microsoft-ui-xaml/issues/7160
AppDomain.CurrentDomain.FirstChanceException += (_, e) => _lastFirstChanceException = e.Exception;
}

private static Assembly? GetWinUIAssembly()
Expand Down Expand Up @@ -127,12 +123,6 @@ private void WinUIUnhandledExceptionHandler(object sender, object e)
return;
}

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

// Set some useful data and capture the exception
var description = "This exception was caught by the Windows UI global error handler.";
if (!handled)
Expand Down

0 comments on commit 79b1dc3

Please sign in to comment.