Repository navigation
Conversation
Roslyn 5.x reports a blocking rude edit as a Ready update (project to rebuild), and UnitTestingHotReloadService commits it before checking for errors. The commit adopts the rejected text and discards the project's emit baseline, so the revert is itself rude and later deltas restart at generation 0 while the app is at generation N. Emit without committing first, and re-emit with commit only when the update is clean. Fixes #25378 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VeCSvPDzotdW75dHUPyYcf
There was a problem hiding this comment.
🔵 Needs a closer look
It changes behavior in a reflection-based Roslyn EnC shim across multiple Roslyn versions, and the author notes the live DevServer end-to-end sequence and net11.0 path were not re-validated, so a human should confirm no subtle EnC regression.
0 open findings
What changed in this PR
This PR fixes a Hot Reload DevServer bug (#25378) where a single rude edit (e.g. ENC0014 adding an interface to a base list) permanently poisons the EnC session until the app restarts. The root cause is that Roslyn 5.x reports a blocking rude edit as a Ready module update with the project marked for rebuild, and the previous shim always emitted with commitUpdates: true, so the rejected text was adopted as the committed baseline and the project's emit baselines were discarded — causing every subsequent delta to restart at generation 0 while the app sits at generation N.
Changes:
WatchHotReloadService.EmitSolutionUpdateAsyncnow emits once withcommitUpdates: false, and only re-emits withcommitUpdates: truewhen the result has updates and no error diagnostics — so rude edits and errored results are never committed.- The reflection delegate signature and a new private
EmitAsynchelper were introduced to carry the explicitcommitUpdatesflag; the XML doc and an outdatedHotReloadManagercomment were updated to match the new "commit only clean updates" behavior. - Added
Given_WatchHotReloadService_RudeEditwhich drives the real Roslyn EnC pipeline (applied → rude → still-rude → revert) to prove a rejected rude edit is not committed and that reverting returns to the last applied update.
| File | Description |
|---|---|
| src/Uno.HotReload/Microsoft/WatchHotReloadService.cs | Adds a commitUpdates flag to the emit delegate and splits emit into a non-committing probe plus a committing re-emit that runs only for clean updates. |
| src/Uno.HotReload/HotReloadManager.cs | Updates a stale comment that assumed emit always advances the EnC baseline as a side effect. |
| src/Uno.HotReload.Tests/Microsoft/Given_WatchHotReloadService.RudeEdit.cs | New test validating a rude edit stays rejected/uncommitted and that reverting returns to the last applied update. |
No blocking issues were found: the public EmitSolutionUpdateAsync(Solution, CancellationToken) signature and its IWatchHotReloadService contract are unchanged, all _emitSolutionUpdateAsync references were updated consistently, and the new test follows the existing Given_WatchHotReloadService.References conventions and compiles cleanly under the project's ImplicitUsings/Nullable settings.
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Heads-up: this is the same root cause I hit in #24085. On Roslyn 5.x a rude edit comes back as #24085 addresses it more broadly. Instead of emitting twice through the UnitTesting wrapper, It needs a rebase on |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25499/wasm-skia-net9/index.html |
|
Superseded by #24085, which fixes the same root cause (Roslyn 5.x commits a rejected rude edit through |
|
|
GitHub Issue: closes #25378
PR Type:
🐞 Bugfix
What changed? 🚀
Current behavior. After one rude edit (e.g. ENC0014, adding an interface to a class's base list), the DevServer never recovers until the app restarts. Every later C# edit is reported
Successbut the app applies nothing, and reverting the rude edit is itself reported as a rude edit.Root cause. On the Roslyn 5.6 the host embeds,
EditSessionreports a blocking rude edit asModuleUpdateStatus.Ready, with the project inProjectsToRebuild(the UnitTesting API passes no running projects).UnitTestingHotReloadService.EmitSolutionUpdateAsynccommits everyReadyresult before it checks for errors.CommitSolutionUpdatethen:Roslyn 4.14 isn't affected: it reports a rude edit as
RestartRequired/Blockedand never commits it.Fix.
WatchHotReloadService.EmitSolutionUpdateAsyncnow emits withcommitUpdates: falsefirst, and re-emits withcommitUpdates: trueonly when the result has updates and no errors. A result with errors is never committed. The cost is a second emit on successful updates; analyses are cached, so only the delta emit runs again (not measured). If it shows up, the upgrade path is bindingIEditAndContinueService.Commit/DiscardSolutionUpdatedirectly.Validation.
Given_WatchHotReloadService_RudeEditdrives the real Roslyn EnC pipeline: applied update → rude edit → rude edit plus a benign change (must still be rude) → revert plus a benign change (must apply). It fails without the fix at the issue's R2 step and passes with it.Uno.HotReload.TestsandGiven_HotReloadService(XAML metadata updates, same shim) pass on net10.0 (Roslyn 5.6). They weren't run on net11.0 (no .NET 11 SDK locally).InternalErrorstreaks described in the issue are expected to share this cause but weren't reproduced.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01VeCSvPDzotdW75dHUPyYcf