Repository navigation
fix(hr): Re-point hot-reload baselines to the RID-specific build outputs - #23799
Conversation
|
Claude finished @dr1rrb's task in 3m 30s —— View job Code Review
Verdict: fix-first — 2 correctness issues (overly-broad exception catches) and 2 test-quality issues (missing assertions). The approach and architecture are sound. SummaryThe design is solid: declarative trigger (RID from the build properties), module-readability as the acceptance gate, and an explicit warning when nothing readable is found all match how Roslyn's EnC itself decides a project is "built". The chaining after Issues found (4)Correctness (2 — inline comments posted):
Test quality (2 — inline comments posted):
Minor / non-blocking
Integration point (
|
|
Claude finished @dr1rrb's task in 5m 19s —— View job Code Review —
|
| Severity | Location | Issue |
|---|---|---|
| Must-fix | spec.md:4 |
uno-private#2256 is a private issue reference — violates AGENTS.md §Public Documentation. Replace with generic description ("an internal investigation into…") in both the status header and the References section. |
| Should-fix | RoslynExtensions.CompilationOutputAlignment.cs:38 |
AlignHeadProjectCompilationOutputs and its delegate FindNewestReadableCandidate do unbounded recursive filesystem I/O (Directory.EnumerateFiles + TryReadMvid in a loop) but accept no CancellationToken. The call site at ServerHotReloadProcessor.MetadataUpdate.cs:102 already holds ct2. Add CancellationToken cancellationToken = default and thread it through. |
| Minor | Given_AlignHeadProjectCompilationOutputs.cs:153 |
When_OutputPathUnset_Then_Warns asserts count only; every other warning test also asserts content. Inconsistency worth closing. |
Confirmed pre-existing bot findings (agree with all five)
| File | Line | Issue |
|---|---|---|
CompilationOutputAlignment.cs |
138 | catch (Exception) in FindNewestReadableCandidate — should narrow to IOException or UnauthorizedAccessException |
CompilationOutputAlignment.cs |
160 | catch (Exception) in TryReadMvid — should narrow to IOException or UnauthorizedAccessException or BadImageFormatException |
CompilationOutputAlignment.cs |
131 | ref/refint exclusion checks only the immediate parent folder — a path like obj/Debug/net10.0-android/ref/sub/App.dll passes the filter. An ancestry walk is more robust. |
Given_AlignHeadProjectCompilationOutputs.cs |
118 | When_Rid_And_OnlyRidlessOutput_Then_EvaluatedKept — missing Assert.AreSame(workspace.CurrentSolution, aligned) to make the "no remap happened" contract explicit. |
Given_AlignHeadProjectCompilationOutputs.cs |
84 | When_Rid_Then_RidSpecificOutputPreferred — missing Assert.AreNotEqual(evaluatedPath, aligned.GetProject(projectId)!.CompilationOutputInfo.AssemblyPath) to lock in that the RID-less twin lost. |
What looks good
- The root-cause analysis is correct and the fix targets it directly (no guard-only mitigation).
- The declarative RID trigger (from the build property bag, not filesystem guessing) is the right design choice.
- Chaining after
FilterHeadProjectTargetFrameworkin the existing pipeline is the right integration point — it operates on the already-reduced solution and its sequential position is safe. - The test fixture using real
CSharpCompilation.Emit()to produce genuine PEs is the right call given the MVID-readability acceptance gate. - The
FindNewestReadableCandidateevaluatedPathexclusion (.Where(!PathEquals(...))) correctly prevents the fallback from re-selecting the known-bad RID-less path. - The spec is well-structured, appropriately scoped as draft, and the failure modes it documents (stale RID-specific output, ambiguous probe, library staleness, config mismatch) are all real and unaddressed by this PR — good signposting.
There was a problem hiding this comment.
Pull request overview
This PR improves Uno Hot Reload reliability on Android (and other RID-split builds) by aligning Roslyn EnC baselines with the RID-specific assembly actually deployed, adding explicit warnings when baselines can’t be read, and introducing unit tests plus a draft follow-up design spec.
Changes:
- Capture the runtime identifier from the client’s MSBuild properties and align the head project’s
CompilationOutputInfo.AssemblyPathto RID-specific build outputs during workspace initialization. - Add
RoslynExtensions.AlignHeadProjectCompilationOutputsto prefer readable RID-specific assemblies (with fallback probing) and emit actionable warnings when no readable baseline exists. - Add unit tests covering alignment behavior and add a draft spec for a future identity-based (MVID) handshake.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor.MetadataUpdate.cs | Chains the new compilation-output alignment step after head TFM filtering during solution load. |
| src/Uno.HotReload/Utils/RoslynExtensions.CompilationOutputAlignment.cs | Implements RID-aware baseline selection by remapping head project compilation output paths based on readable PE/MVID. |
| src/Uno.HotReload.Tests/Utils/Given_AlignHeadProjectCompilationOutputs.cs | Adds unit tests validating RID/no-RID behavior, candidate probing rules, and warning emission. |
| specs/051-hotreload-baseline-identity-handshake/spec.md | Adds a draft spec describing a future protocol to make baseline selection identity-based rather than heuristic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23799/wasm-skia-net9/index.html |
ajpinedam
left a comment
There was a problem hiding this comment.
Some of the Copilot comments seem legit
|
Claude finished @dr1rrb's task in 2m 44s —— View job Code Review
Verdict: fix-first (one remaining finding)The feedback commit addressed all prior findings — Remaining finding (1 inline comment posted)
What's clean
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23799/wasm-skia-net9/index.html |
|
Claude finished @dr1rrb's task in 1m 54s —— View job Code Review
Verdict: shipThe All prior findings are resolved:
What looks good
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23799/wasm-skia-net9/index.html |
The workspace evaluates the head without a RuntimeIdentifier, so EnC captures its baseline from the RID-less intermediate path. A device deployment builds RID-specific: the RID-less assembly either doesn't exist — Roslyn then treats the project as 'not built' and silently emits zero updates — or is a stale twin whose MVID doesn't match the deployed module, so the emitted deltas are dropped by the application. After the target-framework filtering, re-point the kept head flavor's CompilationOutputInfo to the assembly the running application was actually built from: trigger is the RuntimeIdentifier captured from the application's build (declarative — no filesystem guessing in the decision), candidates are accepted only when their module is readable (the same primitive Roslyn's EnC uses to decide a project is 'built'), preferring the RID-specific path over a potentially stale RID-less twin, with a directory probe fallback for custom output layouts (reference-assembly folders excluded). When nothing readable is found, warn explicitly instead of letting EnC no-op silently. Project references are left untouched: MSBuild's project-to-project protocol builds them RID-less, their evaluated paths are correct.
Seven unit tests over AlignHeadProjectCompilationOutputs: no-RID pass-through and anti-silence warning, RID-specific output preferred over a stale RID-less twin, subtree probing with reference-assembly folders excluded, evaluated path kept when no RID output exists, module-readability as the acceptance gate (file existence is not enough), non-head projects untouched, and the null-AssemblyPath warning. Fixture emits real minimal PE files, as the alignment reads module metadata.
RID and loaded-module MVIDs transported in ConfigureServer so the server can select and validate EnC baselines by module identity — the invariant debugger-based EnC gets from the debuggee and watch-mode Roslyn cannot check — instead of readability heuristics. Marked draft: hard requirement to review before implementation (protocol change).
- Required CancellationToken threaded through the output probing (ThrowIfCancellationRequested per candidate, OCE not swallowed) - ref/refint exclusion walks the full ancestry, not only the parent - Path.Join instead of Path.Combine (no rooted-segment reset) - Iterate Project instances directly instead of re-fetching by id - Tests: no-remap AreSame, RID-preference negative check, warning content assertion - Spec 051: private-tracker references reworded to generic terms
The specs are internal working documents; the markdown line-length rule floods PRs touching them with notices.
- Guard a directory-less output assembly path (warn + skip) instead of null-forcing Path.GetDirectoryName, with test coverage - Narrow TryReadMvid to the expected open/read/parse failures
ac1ee5e to
8f90603
Compare
|
Claude finished @dr1rrb's task in 1m 52s —— View job Code Review
Verdict: fix-first (one remaining finding)The second-round feedback commit ( Remaining finding (1 inline comment posted)
What's clean
|
GitHub Issue: unoplatform/uno-private#2256
Master port of #23798 (
release/stable/6.6-first fix), with unit-test coverage and a draft follow-up spec. Second half of the uno-private#2256 investigation — the first half (netX.0-skiaTFM misreport) is #23790.PR Type:
🐞 Bugfix
What changed? 🚀
With the correct target framework reported and the workspace correctly restricted, hot reload on Android still produced
Found 0 metadata updates— silently, for C# and XAML edits alike.The hot-reload workspace evaluates the head project without a
RuntimeIdentifier, so EnC captures its baseline from the RID-less intermediate assembly path (obj/Debug/net10.0-android/App.dll). A device deployment however builds RID-specific (obj/Debug/net10.0-android/android-x64/App.dll): the RID-less assembly either does not exist — Roslyn's EnC then treats the project as "not built" (EditSession:mvid == Guid.Empty) and silently emits zero updates — or is a stale twin from an earlier RID-less build whose MVID does not match the deployed module, so emitted deltas would be dropped by the application.RoslynExtensions.AlignHeadProjectCompilationOutputs(new,Uno.HotReload/Utils, chained afterFilterHeadProjectTargetFrameworkin the solution load): re-points the kept head flavor'sCompilationOutputInfoto the assembly the running application was actually built from. Trigger is declarative — theRuntimeIdentifiercaptured from the application's build; no filesystem guessing in the decision, and no global property pushed to the workspace (a global RID would relocate the expected outputs of every project reference, which MSBuild's project-to-project protocol builds RID-less). Candidates are accepted by module readability (a valid PE with an MVID — the primitive Roslyn's EnC uses to decide a project is "built"), preferring the RID-specific path over a potentially stale RID-less twin, with a recursive probe of the evaluated output directory as fallback for custom layouts (reference-assemblyref/refintfolders excluded). Project references are left untouched.project not builtinside Roslyn's own EnC session log.Uno.HotReload.Tests) covering the no-RID pass-through and warning, RID-specific preference over the stale twin, subtree probing withref/refintexclusion, module-readability as the acceptance gate, untouched non-head projects, and the null-AssemblyPathwarning — the fixture emits real minimal PE files since the alignment reads module metadata.specs/051-hotreload-baseline-identity-handshake, marked draft — hard requirement: needs reviews before implementation): the follow-up design transporting theRuntimeIdentifierand the loaded modules' MVIDs inConfigureServer, so baseline selection and diagnostics rely on module identity (the invariant debugger-based EnC gets from the debuggee) instead of readability heuristics. Not implemented here.PR Checklist ✅
Screenshots Compare Test Runresults.