Repository navigation
Akka.Hosting: MAUI detection must not throw under InvariantGlobalization - #8783
Merged
Aaronontheweb merged 1 commit intoOct 6, 2026
Conversation
Util.IsRunningInMaui called Assembly.GetName() on every loaded assembly. For satellite assemblies that builds a CultureInfo, which throws CultureNotFoundException when InvariantGlobalization is on. Read Assembly.FullName instead and treat any detection failure as 'not MAUI'. Adds Akka.Hosting.InvariantGlobalization.Tests, which runs in invariant mode and loads a real 'cs' satellite assembly.
Aaronontheweb
enabled auto-merge (squash)
October 6, 2026 20:08
Aaronontheweb
added a commit
that referenced
this pull request
Oct 6, 2026
Aaronontheweb
added a commit
to Aaronontheweb/akka.net
that referenced
this pull request
Oct 6, 2026
…T canary Assembly.FullName also throws CultureNotFoundException for satellite assemblies on Native AOT under InvariantGlobalization, so the catch in IsMauiAssembly is required. Fix the comment, narrow bare catch blocks to catch (Exception). Add a Czech satellite resource to the Hosting AOT canary so it reproduces the akkadotnet#8782 crash, and strengthen the InvariantGlobalization tests (hazard canary, direct FullName assertion, order-independent enumeration test). Follow-up to akkadotnet#8783, refs akkadotnet#8782
This was referenced Oct 6, 2026
Merged
This was referenced Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Util.IsRunningInMauicalledAssembly.GetName()on every loaded assembly. For a satellite assembly (for example thecsresources that ship with Microsoft.Data.SqlClient),GetName()builds aCultureInfo, which throwsCultureNotFoundExceptionwhenInvariantGlobalizationis on. That crashedAddAkkaat startup. MAUI detection now readsAssembly.FullName(a plain string) and treats any detection failure as "not MAUI".Changes
Util.cs: split detection intoDetectMaui,IsMauiAssemblyandIsMauiAssemblyName. The check readsAssembly.FullNameand compares the prefixMicrosoft.Maui(ordinal), so real MAUI apps are detected the same way as before. Each assembly check and the enumeration are wrapped so a failure returnsfalse. No new reflection, so no new trim/AOT warnings.FriendsOf.cs:InternalsVisibleTofor the new test project.Akka.Hosting.InvariantGlobalization.Testsproject (added toAkka.slnx). It setsInvariantGlobalization=trueand builds a realcssatellite assembly from a.resx. It has its own project because invariant mode changes the sort order in the existingLogStateSnapshotSpecsVerify snapshots inAkka.Hosting.Tests.Testing
Should_NotThrow_When_SatelliteAssemblyIsLoadedUnderInvariantGlobalizationandShould_ReturnFalse_When_AssemblyEnumerationFailsfail withCultureNotFoundException: ... cs is an invalid culture identifieratRuntimeAssembly.GetName. With the fix, all 3 new tests pass.Akka.Hosting.Tests: 155 passed.dotnet build -warnaserroris clean.PublishAot, linux-x64): publish succeeds, prints[canary-hosting] OK, andscripts/CheckAotWarnings.csreports no new trim/AOT warnings.The same crash reproduces on the JIT with
InvariantGlobalization=true, so it is a globalization-mode problem and not specific to AOT.Breaking changes
None expected. The new methods are
internal.v1.5has the identicalIsRunningInMauicode insrc/contrib/hosting/Akka.Hosting/Util.cs, so this needs a backport tov1.5.Fixes #8782