Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add WinUIUnhandledExceptionIntegration on Windows only #3055

Merged
merged 9 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ If you have conflicts, you can opt-out by adding the following to your `csproj`:
### Fixes

- Moved the binding to MAUI events for breadcrumb creation from `WillFinishLaunching` to `FinishedLaunching`. This delays the initial instantiation of `app`. ([#3057](https://github.com/getsentry/sentry-dotnet/pull/3057))
- The SDK no longer adds the `WinUIUnhandledExceptionIntegration` on non Windows platforms ([#3055](https://github.com/getsentry/sentry-dotnet/pull/3055))

### Dependencies

Expand Down
3 changes: 2 additions & 1 deletion src/Sentry/SentryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ internal IEnumerable<ISdkIntegration> Integrations
#endif

#if NET5_0_OR_GREATER && !__MOBILE__
if ((_defaultIntegrations & DefaultIntegrations.WinUiUnhandledExceptionIntegration) != 0)
if ((_defaultIntegrations & DefaultIntegrations.WinUiUnhandledExceptionIntegration) != 0
&& RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
yield return new WinUIUnhandledExceptionIntegration();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,5 @@
Args: [
SentryDiagnosticListenerIntegration
]
},
{
Message: Registering integration: '{0}'.,
Args: [
WinUIUnhandledExceptionIntegration
]
}
]
5 changes: 4 additions & 1 deletion test/Sentry.Tests/SentryOptionsTests.verify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ namespace Sentry.Tests;
[UsesVerify]
public partial class SentryOptionsTests
{
[Fact]
[SkippableFact]
public Task Integrations_default_ones_are_properly_registered()
{
// Windows additionally adds `WinUIUnhandledExceptionIntegration`
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have two tests then? one that tests we have this on Windows? Instead of skipping

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had that but it messed with the verify. I guess I need to run this on windows then too to generate the expected file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah you need to have a file per platform, just saw this on another PR:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of those per OS I imagine


InMemoryDiagnosticLogger logger = new();
SentryOptions options = new()
{
Expand Down
Loading