Repository navigation
Conversation
The iOS publish of Sentry.MauiTrimTest was commented out because a device build asked for signing certificates. Trimming and NativeAOT compilation run before code signing, so publishing with EnableCodeSigning=false gives the same analysis. The step also skips the Xcode version check, because the net10.0-ios26 pack only accepts Xcode 26.0 and the runner only has 27.2. iOS uses TrimMode=partial and treats MT2387 as an error, which catches the launch crash from #5855 if IsTrimmable ever leaves Sentry.Bindings.Cocoa. The job restores the Cocoa SDK cache instead of building it from source. Fixes #3852 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Looks good. This solves #3852. The issue assumed the iOS trim publish needed provisioning profiles on CI, and with EnableCodeSigning=false it doesn't, because ILLink and the NativeAOT compile run before signing. That fixes the cause rather than working around it.
A few notes, none blocking:
TrimMode=partialon iOS (test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj): the reasoning holds.SentryandSentry.Mauiare rooted withRootMode="All", andSentry.Bindings.CocoasetsIsTrimmable, so all three are still trimmed and analyzed in partial mode, and you also get the MT2387 guard for #5855. The trade-off is that iOS no longer runs the full-mode setup that most NativeAOT apps use. If that ever matters, publishing iOS a second time with-p:TrimMode=full(about a minute) would cover both. Not needed for this PR.- The #5855 guard runs on
net10.0-ios26only. #5855 was reported on .NET 11 with the new assembly preparer. You've already said the local revert of #5857 fails with MT2387 here, so the guard works on .NET 10. The .NET 11 follow-up you mentioned closes the rest. ValidateXcodeVersion=false: the rootDirectory.Build.propsalready sets this, but this project deliberately doesn't import the root props, so it does need its own copy. 👍- Cocoa cache (
.github/workflows/build.yml, trim-analysis job): this job only restores the cache and never saves it. It also depends only onbuild-sentry-native, so right after a Cocoa submodule bump it can start before another job has saved the new key. In that case it builds Cocoa from source (about 15 min) instead of failing. That's fine, just slower on those runs. - Tests: the new step is the test. Per the description, it fails on the two real regressions (IL2057 from
[SuppressMessage]in Cocoa-only code, and MT2387 with #5857 reverted), and the macOS and Android steps miss both. That's the evidence that matters. The Trim analysis check was still running when I looked, so worth confirming it goes green on the runner image.
This is an automated preliminary review.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5961 +/- ##
=======================================
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. 🚀 New features to boost your workflow:
|
| <!-- Partial trimming leaves assemblies that aren't trimmable untouched. NativeAOT apps that use it crash at launch | ||
| when one of ours needs the dynamic registrar, which the iOS SDK reports only as warning MT2387. | ||
| See https://github.com/getsentry/sentry-dotnet/issues/5855 --> | ||
| <TrimMode>partial</TrimMode> |
There was a problem hiding this comment.
This is probably the most contentious bit. I know this is the scenario that resulted in:
However that's not the typical way to build AOT apps and Microsoft themselves warn against it:
https://github.com/dotnet/macios/blob/23eb1c2c9465fe76c810c8a69982c1254161f4b0/dotnet/targets/Xamarin.Shared.Sdk.targets#L524
I think we've got two options:
- Either we run the trim tests with both partial and full trimming
- Or we only run with full trimming (the most common scenario and the most important one for us to check)
#3841 added the iOS trim step commented out, because publishing for a device asked for signing certificates. It doesn't need them. Trimming and NativeAOT compilation run before code signing, so with
EnableCodeSigning=falsewe get an unsigned app and the same analysis.Sentry.MauiTrimTestnow publishes unsigned and skips the Xcode version check. Thenet10.0-ios26pack only accepts Xcode 26.0, and the runner image only has 27.2.TrimMode=partialand treats warning MT2387 as an error. iOS NativeAOT (.NET 11): app crashes at launch in SentryObjCOptions.set_BeforeSend because Sentry.Bindings.Cocoa isn't marked IsTrimmable (MT2387) #5855 crashed in that setup, and the iOS SDK only warns about it with MT2387. Full mode doesn't show that warning at all. Partial mode still catches the trimming mistake full mode caught, because the app roots our assemblies, so the trimmer and the AOT compiler analyze all of their code either way.I checked it locally with Xcode 27.2 and no signing identity. The publish passes in about a minute from a clean build. It fails with IL2057 when Cocoa-only code uses
[SuppressMessage]where it needs[UnconditionalSuppressMessage], and with MT2387 when I revert #5857. The macOS and Android steps miss both.Follow-up
net11.0-ios27.2andnet11.0-android37.0. I'm doing that in a separate PR stacked on this one.build.yml. Seven jobs across three workflows now compute the key, restore the cache and mostly save it again with the same steps, so I'll move them into a shared action in another PR.Closes #3852
#skip-changelog