Repository navigation
fix(navigation): only map route types from the resolver's own load context - #3249
Merged
Merged
Conversation
- Add Uno.Extensions.Navigation.Tests to Uno.Extensions.sln and Uno.Extensions-packageonly.slnf, so the package stage builds it and its VSTest step picks up the assembly - Reference Uno.Extensions.Navigation.WinUI from the test project, so RouteResolverDefault can be tested directly in a plain test host - Turn off central transitive pinning in that project: the central Uno.WinUI version is $(UnoVersion), which only Uno.Sdk defines, so pinning dropped Uno.WinUI and the Navigation.WinUI module initializer failed to find Uno.UI - Prepares the regression tests for #3248 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbFsmmtympxmbLYQU2JKGQ
…contexts - When_TypeOnlyInOtherLoadContext_Then_NotResolved: a type loaded only into another collectible AssemblyLoadContext must not resolve by name, while a type in the default context still does - When_ResolverInOwnLoadContext_Then_OwnTypeWinsOverDefault: a resolver loaded into an app's own context resolves the app's type ahead of a same-named type in the default context, and still sees default-context types - Both fail on the current code, which scans every assembly in the process (#3248) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbFsmmtympxmbLYQU2JKGQ
… and default load contexts - RouteResolverDefault.LoadedTypes scanned every assembly in the process, including other apps' collectible AssemblyLoadContexts; a host that loads apps into their own collectible contexts could crash while reading types from a context that was unloading (#3248) - Scan the resolver's own load context, then the default one, skipping default assemblies whose simple name the own context already has (same scoping as the hot reload agent); the app's own type now wins over a same-named type in the default context - In a normal app the own context is the default one, so the scanned set is unchanged; assemblies loaded into a separate context (for example with Assembly.LoadFile) no longer feed the implicit by-name lookup and need an explicit ViewMap/RouteMap - Log the load context and assembly count at Debug when the type index is built, and say in the unresolved-path warning where implicit lookup searches Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbFsmmtympxmbLYQU2JKGQ
…resolver's context also has - When_AssemblyAlsoInOwnLoadContext_Then_DefaultCopyIgnored: an assembly with the same simple name sits in both the default context and the resolver's own context; a type only the default copy defines must not resolve, while the own copy's type does - Fails if the simple-name filter in OwnAndDefaultContextAssemblies is removed - Share the own-context resolver setup between the two own-context tests - Describe the host scenario in neutral terms in the class remarks - Part of #3248 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbFsmmtympxmbLYQU2JKGQ
…ontext log - Restore the original "Could not resolve type for path" warning; it fires on every ordinary suffix miss, so the load-context hint misled - Name only the default load context in the Debug log when the resolver runs there - Document where precedence comes from (own context first, first entry kept) and why a default-context assembly the own context also has is skipped - Part of #3248 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbFsmmtympxmbLYQU2JKGQ
kazo0
force-pushed
the
dev/sb/3248-route-resolver-alc
branch
from
October 15, 2026 16:37
3fcd3ee to
3c95e82
Compare
kazo0
marked this pull request as ready for review
October 15, 2026 18:30
kazo0
enabled auto-merge
October 15, 2026 18:30
- Turning pinning off let restores without package pruning (the Windows package and sample builds) pick System.Net.Http 4.3.0 and System.Text.RegularExpressions 4.3.0, which NuGet audit fails with NU1903 - Keep pinning on and give this plain test host the $(UnoVersion) that Uno.Sdk projects get, read from the Uno.Sdk.Private pin in global.json, so Uno.WinUI is pinned instead of dropped - Turn off the UNOB0025 runtime-host check here: the tests load navigation types but never start the Uno runtime - Part of #3248 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbFsmmtympxmbLYQU2JKGQ
rajamatt
approved these changes
Oct 15, 2026
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
5 of 7 tasks
kazo0
added a commit
that referenced
this pull request
Oct 27, 2026
…te doesn't resolve - Since #3249, a view in another AssemblyLoadContext no longer resolves by name, but the warning read the same as a typo, and the scope was only logged at Debug - The "Could not resolve type for path" warning now says which load contexts were searched and that types elsewhere need an explicit ViewMap/RouteMap - Add Given_RouteResolverDefault in Navigation.UI.Tests: through the resolver itself, a view model loaded only into another load context does not resolve, one in the resolver's own context does, and the warning names the searched contexts; making the index scan every assembly in the process fails it - Gated to desktop, like the repo's other emitted-assembly tests; no CI lane runs Navigation.UI.Tests today (the desktop lane's RuntimeTestsFilter leaves it out and the skia !_HotReload stage is disabled), so it was run locally on the desktop head - Part of #3248 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PZQ75nMpDZr9xNdRwacVQN
kazo0
added a commit
that referenced
this pull request
Oct 27, 2026
fix(navigation): follow-ups to #3249 — test host without Navigation.WinUI, case-insensitive name match, docs
This was referenced Nov 3, 2026
agneszitte
added a commit
that referenced
this pull request
Nov 3, 2026
…ntext (backport #3249) - Backport of #3249 to servicing/7.4 - Uno.Extensions.sln: keeps 7.4's Authentication test projects next to the Uno.Extensions.Navigation.Tests entries #3249 adds Co-Authored-By: Claude Opus 5.5 <[email protected]>
agneszitte
added a commit
that referenced
this pull request
Nov 3, 2026
…nUI, case-insensitive name match, docs (backport #3254) - Backport of #3254 to servicing/7.4, applied without changes Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
GitHub Issue (If applicable): closes #3248
PR Type
What is the current behavior?
RouteResolverDefault.LoadedTypesbuilds its by-name type map fromAppDomain.CurrentDomain.GetAssemblies(), so it includes types from everyAssemblyLoadContextin the process.AccessViolationException(Hot reload can crash the process when apps run in collectible load contexts #3248).What is the new behavior?
HotReloadAgentdoes). The app's own type wins over a same-named type in the default context.Assembly.LoadFile) no longer feed the implicit by-name lookup. ExplicitViewMap/RouteMapregistrations are unaffected.Reviewer's guide
src/Uno.Extensions.Navigation.UI/RouteResolverDefault.cs—LoadedTypesandOwnAndDefaultContextAssemblies.226c4aec4,2facced08): no navigation unit test ran in CI. They addUno.Extensions.Navigation.Teststo the solution and toUno.Extensions-packageonly.slnf, so the package build's VSTest step picks it up (the existingNavigatorExtensionsTestsruns too). The test project references the WinUI navigation project; as a plain SDK project it reads the Uno version fromglobal.json(UnoVersion, which Uno.Sdk projects get from the SDK), so central transitive pinning stays on. It also disables the UNOB0025 runtime-host check: the tests load Navigation types but never start the Uno runtime. (226c4aec4first turned pinning off;2facced08reverts that after it let vulnerable transitive packages through on the Windows restore.)f2af9ccdeand5b3fc253a):When_TypeOnlyInOtherLoadContext_Then_NotResolved— a type emitted into a separate collectible context must not resolve; a default-context type still must. Fails on the old code.When_ResolverInOwnLoadContext_Then_OwnTypeWinsOverDefault— a second copy of Navigation.UI in its own context resolves its ownSharedNameModelover the default context's. Fails on the old code.When_AssemblyAlsoInOwnLoadContext_Then_DefaultCopyIgnored— when the resolver's context has its own copy of an assembly, the default context's copy is not scanned. Fails if the simple-name filter is removed.3c95e826areverts that, the message is unchanged.ToDictionaryDistinct(Uno.Core.Extensions.Collections) keeps the first entry for a key; that is what makes own-context-first win.Interaction with #3238
The new Android and iOS hot-reload lanes run the navigation hot-reload tests in the app's own process, which is the normal case: the resolver lives in the default load context. There the scanned set is exactly what it was before.
AssemblyLoadContext.Default.Assembliesfilters the same list thatAppDomain.GetAssemblies()returns. On Mono, every assembly is in the default context unless code creates another load context, and hot-reload deltas are applied to the existing assembly without loading a new one. The two PRs touch different files and merge cleanly. This PR stays a draft until #3238 merges, so its CI also runs the new mobile hot-reload lanes.PR Checklist
Other information
servicing/7.4after merge (RouteResolverDefault.csis identical there; the test project's pinning setting may need a look).🤖 Generated with Claude Code
https://claude.ai/code/session_01MbFsmmtympxmbLYQU2JKGQ