Skip to content

ci: Add .NET 11 to the MAUI trim analysis - #5962

Open
ric-oliv wants to merge 3 commits into
ci/ios-trim-analysisfrom
ci/trim-analysis-net11
Open

ric-oliv wants to merge 3 commits into
ci/ios-trim-analysisfrom
ci/trim-analysis-net11

Conversation

@ric-oliv

@ric-oliv ric-oliv commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Stacked on #5961, so that one goes first.

The package ships net11.0-ios27.2 and net11.0-android37.0, but the MAUI trim app only targeted .NET 10. I added both .NET 11 target frameworks to Sentry.MauiTrimTest, and a publish step for each to the trim-analysis job.

The .NET 11 iOS SDK rejected the 2024 MAUI template, so I brought the app in line with a fresh dotnet new maui. It now has a scene delegate and a UIApplicationSceneManifest, which fixes MT7199. I also dropped the obsolete Frame and ListView styles and made sender nullable in MainPage, because MAUI 11 turns both into build errors. Android on .NET 11 needs API 24, so the app uses 24 there, like our root Directory.Build.props does.

The net11.0-ios27.2 pack accepts the runner's Xcode 27.2, so only the .NET 10 iOS publish still skips the Xcode version check.

Until now the Android steps couldn't catch a trim warning. The Android SDK defaults to partial trimming and then suppresses every trim analysis warning, so the app now uses full trimming on Android. Both Android publishes stay clean with it.

I kept the .NET 10 iOS publish. The Sentry code is the same for both target frameworks, but the toolchains differ. .NET 10 runs ILLink before the AOT compiler, while .NET 11 skips ILLink and runs a new assembly preparer, which is the path #5855 was reported on. Both versions ship, so both get checked.

I checked it locally with Xcode 27.2. Both iOS publishes fail when Cocoa code suppresses a trim warning with [SuppressMessage] instead of [UnconditionalSuppressMessage], and when Sentry.Bindings.Cocoa loses IsTrimmable. Both Android publishes now fail on the same [SuppressMessage] mistake in Android code, which they let through before. On the first CI run the two new steps added about 6 minutes to the trim job, which still finishes well before the macOS build.

#skip-changelog

The package ships net11.0-ios27.2 and net11.0-android37.0, but Sentry.MauiTrimTest only targeted
net10. Add both TFMs and a publish step for each to the trim-analysis job.

The .NET 11 iOS SDK rejects the 2024 MAUI template, so the app follows a fresh dotnet new maui:
a scene delegate and UIApplicationSceneManifest (MT7199), no Frame and ListView styles (CS0618)
and a nullable sender in MainPage (CS8622). Android on .NET 11 needs API 24. Only the net10 iOS
publish still skips the Xcode version check, because the net11 pack accepts Xcode 27.2.

Refs #3852

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good to approve, with optional comments

Adds net11.0-ios27.2 and net11.0-android37.0 to Sentry.MauiTrimTest and publishes both in the trim-analysis job, so the .NET 11 targets the package ships get the same trim/AOT analysis as .NET 10. No linked issue; this is the .NET 11 follow-up noted in #5961.

  • Optional: .github/workflows/build.yml, "Publish Test app (Android, net11.0)": like the existing .NET 10 Android step, this only proves the app builds until the full-trimming follow-up lands, because partial trimming hides the trim warnings. A short comment on the Android steps would stop anyone from reading a green run as a trim-clean result.
  • Optional: test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj hardcodes the TFMs and the Android 24.0 minimum, which duplicates LatestAndroidTfm/LatestIosTfm and the minimums in the root Directory.Build.props. The isolation comment explains why, but the next TFM bump has to update both places. A line in the CONTRIBUTING.md ".NET major version" checklist would help.
  • Optional: the new publish steps haven't reported in CI on this PR yet. Wait for a green Trim analysis job on the runner image before merging, since the local run is the only one so far.

This is an automated preliminary review.

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.70%. Comparing base (d61ea70) to head (87201c1).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           ci/ios-trim-analysis    #5962   +/-   ##
=====================================================
  Coverage                 77.70%   77.70%           
=====================================================
  Files                       535      535           
  Lines                     19731    19731           
  Branches                   3934     3934           
=====================================================
  Hits                      15332    15332           
  Misses                     3544     3544           
  Partials                    855      855           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ric-oliv and others added 2 commits November 18, 2026 18:30
The Android SDK defaults release builds to partial trimming, and with it sets
SuppressTrimAnalysisWarnings, so the Android publishes of Sentry.MauiTrimTest never reported a trim
warning. Full trimming turns the analysis back on. Both Android publishes stay clean, and both now
fail with IL2057 when Android code uses [SuppressMessage] where it needs
[UnconditionalSuppressMessage].

Refs #3852

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trim apps keep literal TFMs, so a .NET major bump has to update them, the Android and iOS
minimum versions in Sentry.MauiTrimTest and the trim-analysis publish steps by hand.

Refs #3852

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ric-oliv
ric-oliv marked this pull request as ready for review November 18, 2026 20:10
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 18, 2026
</PropertyGroup>

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<!-- The Android SDK defaults to partial trimming, and then suppresses all trim analysis warnings -->

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<!-- The Android SDK defaults to partial trimming, and then suppresses all trim analysis warnings -->
<!-- The Android SDK defaults to partial trimming -->

Since nothing in the code touches warnings, it's confusing to mention them

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants