Repository navigation
fix(hr): harden the collectible analyzer loader (review follow-up of #23863) (backport #23947) - #23971
Merged
kazo0 merged 3 commits intoAug 11, 2026
Conversation
…follow-up) Delegate resolution to the compiler context (LoadFromAssemblyName, like Roslyn's own loader) so host dependencies it has not loaded yet unify to it instead of loading a split-identity analyzer-local copy; publish shadow copies via a staging file + atomic rename so concurrent loads (threads or dev-server processes sharing the temp root) never observe a partial PE; retain every dependency location registered per file name and resolve to the best version (exact match, else highest compatible) instead of first-registered-wins; Path.Join throughout. (cherry picked from commit ceae5b4)
GetBestKnownPath now takes the already-validated simpleName (self-contained lookup and identity comparison instead of relying on a guard in its caller), and the highest-compatible-version fallback gets dedicated coverage — in a fresh context, since a context that already loaded the simple name answers later requests from its own by-name cache without calling Load() again. (cherry picked from commit 781487c)
The shadow cache root moves from the shared temp directory to per-user LocalApplicationData (user-only mode on Unix): this closes the shared-root pre-plant/swap surface and retires, by namespace, anything a pre-atomic- publish version of the cache may have left truncated at still-reachable keys. The key now folds in the file size, staging files are never leaked (cleanup on every failure path plus an age-gated startup sweep), the identity check applies to every registered candidate (single-candidate fast path removed), an optional IReporter traces candidate selection and compiler-context fallbacks, and simple names carrying invalid file-name characters are rejected before any probing. (cherry picked from commit f011378)
kazo0
enabled auto-merge
August 5, 2026 14:00
kazo0
approved these changes
Aug 5, 2026
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23971/wasm-skia-net9/index.html |
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.
Follow-up to #23863 — the review-round-4 changes: the PR auto-merged the moment its last review conversations were resolved, before these fixes were pushed, so the "Done" replies on those threads describe the changes delivered here.
Changes (all on
CollectibleAnalyzerAssemblyLoader)Loadnow tries_compilerContext.LoadFromAssemblyName(assemblyName)(bare-catch fall-through, the exact shape of Roslyn's own loader) instead of probing the context's already-loadedAssemblies. Dependencies the compiler context can resolve but has not loaded yet materialize in it — no split-identity analyzer-local copy — and resolution stays correct when assemblies keep appearing at runtime (e.g. NuGet packages added to the app through hot reload). This also removes the per-Loadlinear scan discussed in fix(hr): align workspace analyzer flavors and Roslyn with the SDK compiler (spec 053) #23863 (comment) without any cache to invalidate: the ALC's internal by-name lookup is authoritative and re-probed by the runtime on every miss.File.Move; the PDB is published before the DLL so a visible DLL means the bundle is whole. Rename-publish was chosen over an in-processConcurrentDictionary<string, Task<string>>because the shadow key is deterministic and the temp root shared: the race also exists across dev-server processes, and a process killed mid-copy would otherwise poison the key with a permanent partial file.AddDependencyLocationretains every location registered for a file name (distinct projects may carry distinct versions of the same analyzer package), and resolution mirrors Roslyn'sGetBestPath: exact requested version wins, otherwise the highest version with a compatible identity (simple name + public key token when requested).Path.Jointhroughout the file and the test helper (CodeQL findings).Validation
Uno.HotReload.Tests: 120/120 passing, including two new regression tests —When_CompilerContextResolvesLazily_Then_AnalyzerRequestsUnifyToIt(lazily-resolving compiler context + same-directory copy of the assembly: the request must materialize in the compiler context; fails on the previous enumeration-based code) andWhen_MultipleVersionsRegistered_Then_RequestedVersionWins(two registered versions: the exact requested one must win over the first registered).Uno.HotReloadcompiles warning-free on both flavors: net9.0 (Roslyn 4.14) and net10.0 (Roslyn 5.6).This is an automatic backport of pull request #23947 done by [Mergify](https://mergify.com).