chore: Device/integration tests for mobile on .net10#4750
chore: Device/integration tests for mobile on .net10#4750jamescrosswell merged 40 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4750 +/- ##
=======================================
Coverage 73.85% 73.85%
=======================================
Files 483 483
Lines 17578 17578
Branches 3464 3464
=======================================
+ Hits 12982 12983 +1
+ Misses 3742 3741 -1
Partials 854 854 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Tricky... locally everything passes for me: However in CI we've got 2 tests failing in Debug and 2 tests failing in Release: Looking at the 2 envelopes received for the Java crashes (java_received.json) the only difference is the timestamp: ... so it looks like we're getting duplicate envelopes being sent for some reason |
|
@supervacuus wondering if you might have some insights. When bumping to .NET 10, our Android integration tests fail when creating a native crash...
Basically we have a single crash, so we're expecting a single envelope... but instead we get loads of envelopes (from sentry.native). We don't see the same behaviour in .net 9 (those tests pass fine)... so maybe a change in behaviour in terms of how .net 10 wraps signals 🤷🏻 although, if so, not one that's documented in the release notes. It's not always 16 envelopes - in previous runs it's been 26 or 28 etc. so basically just "way more than expected". I can't reproduce this locally - it only happens to us in CI (which makes it pretty tricky to analyse). It looks like maybe there are some tests that are already relevant in the native repo, so I created a PR to bump these to .NET 10 to see if we see the same issue there... although those are run on Linux Alpine (not Android) so not necessarily expecting the same results: |
|
Hi @jamescrosswell 👋
From what I have seen over the last year in the .NET runtime's "documentation" on signal usage, I would be surprised if a change in behavior in that area made its way into the release notes. I don't have an immediate idea and it is rather hard to follow for me, because i don't know what your test does and which of those outputs are relevant. However, intuitively, a variable number of envelopes rather than one looks like a signal loop (typically caused by an But it's really hard to say for me from what I know about your tests. It would be interesting to see all envelopes rather than just their count.
But does it repro on CI stably? Would it be possible to
Yes, the .NET tests fail with that bump, but likely due to .NET 10 being an unsupported target (see my response). I would also ping @jpnurmi on this topic. |
This reverts commit 344c80a.
Yes normally. He's unfortunately unavailable until next year 😢
That's fair... JP actually wrote the tests. They're supposed to be high level simple integration tests in pester/powershell that compile a .net app and run it, passing in an argument that determines what the app should do. For example, in the test that's failing here, the argument is
Hm, that gives me some clues. After each test, the app gets shut down with this. That should shut down Sentry before calling I'll dig into that and report back - thanks @supervacuus 🙏🏻 |
|
So I tried cascading the SDK shutdown to the Java SDK: sentry-dotnet/src/Sentry/Internal/Hub.cs Line 874 in 278c04c Unfortunately the Java SDK also doesn't cascade this to the instance of the native SDK 😢 I guess it would be possible to rectify that in the Java SDK but that would require a series of new releases etc. I'll see if I can find an alternative workaround. |
|
@Flash0ver in the latest test runs we're seeing:
However when I run the same code in a sample application, I don't see the same behaviour, so I'm pretty sure this is as a result of the difficulty in finding a way to shut the app down in a way that does't create a signal loop and lots of other unrelated exceptions that get captured by the native client. One possible "proper fix" would be to cascades the SDK shutdown logic, but I don't want to delay the version 6 release in order to build that so I think we park this PR for the time being and circle back post v6 release (perhaps in the new year when JP is back on deck). |
|
Good news. Both issues are in the test infrastructure, and fixes are on the way. The |
Awesome, thanks @jpnurmi - I'm back on deck now as well. So once those two issues have been resolved, we could reopen this PR? |
jpnurmi
left a comment
There was a problem hiding this comment.
what about ios integration tests?
That was going to be next yeah... wanted to get Android going first though, since it's typically easier. |
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
| <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> | ||
| <!-- Pin target iOS version so that our tests don't break when new versions of Xcode are released. | ||
| 'netX.0-ios' resolves the latest version of the iOS SDK otherwise. --> | ||
| <TargetPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">18.0</TargetPlatformVersion> |
There was a problem hiding this comment.
We could leave this in there (bump to 26.2 of course)... that would be consistent with what we've done for the IntegrationTestApp
| <ItemGroup Condition="'$(TargetFramework)' == 'net9.0'"> | ||
| <!-- https://github.com/advisories/GHSA-5f2m-466j-3848 --> | ||
| <PackageReference Include="System.Private.Uri" Version="4.3.2"/> | ||
| </ItemGroup> |
There was a problem hiding this comment.
Security package condition will never match target framework
Medium Severity
The ItemGroup condition '$(TargetFramework)' == 'net9.0' will never match because the project's target frameworks are net9.0-android, net10.0-android, and net10.0-ios. The exact string net9.0 never appears as a target framework. This means the security fix for GHSA-5f2m-466j-3848 (System.Private.Uri package reference) will never be included. The condition should use $(TargetFramework.StartsWith('net9')) to match platform-specific TFMs, consistent with patterns used elsewhere in the codebase like Sentry.Bindings.Android.csproj.
There was a problem hiding this comment.
Seems this section is redundant now... when I tweaked the condition per the suggestion above I got:
error NU1510: Warning As Error: PackageReference System.Private.Uri will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
I've removed it altogether.
…ill not be pruned
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| <!-- Pin target iOS version so that our tests don't break when new versions of Xcode are released. | ||
| 'netX.0-ios' resolves the latest version of the iOS SDK otherwise. | ||
| --> | ||
| <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net10.0-ios26.2</TargetFrameworks> |
| # Note: we can't run against net10 and net9 becaus .NET 10 requires Xcode 26.2 and .NET 9 requires Xcode 26.0. | ||
| # The macOS GitHub Actions runners only have Xcode 26.1+ installed and no support for Xcode 26.2 is planned for | ||
| # net9.0-ios: https://github.com/dotnet/macios/issues/24199#issuecomment-3819021247 |
| <!-- Note: we can't run against net9-ios because .NET 10 requires Xcode 26.2 and .NET 9 requires Xcode 26.0. | ||
| The macOS GitHub Actions runners only have Xcode 26.1+ installed and no support for Xcode 26.2 is planned for | ||
| net9.0-ios: https://github.com/dotnet/macios/issues/24199#issuecomment-3819021247 | ||
| --> | ||
| <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net10.0-ios</TargetFrameworks> |
| <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> | ||
| <!-- Pin target iOS version so that our tests don't break when new versions of Xcode are released. | ||
| 'netX.0-ios' resolves the latest version of the iOS SDK otherwise. --> | ||
| <TargetPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">18.0</TargetPlatformVersion> |




Resolves #4744
#skip-changelog