Skip to content

fix(hr): never commit an EnC baseline for an update that was not applied (backport #24085) (6.8) - #25946

Merged
agneszitte merged 9 commits into
servicing/6.8from
dev/agzi/backport-hr-rude-edit-baseline-6.8
Nov 3, 2026
Merged

agneszitte merged 9 commits into
servicing/6.8from
dev/agzi/backport-hr-rude-edit-baseline-6.8

Conversation

@agneszitte

Copy link
Copy Markdown
Member

GitHub Issue: Related to #25378

Backport of #24085 to servicing/6.8. Studio 3.3 needs it (confirmed by Steve).

Merge after #25495 (the 6.8 backport of #25420). This fix builds on it, so this branch also contains its commits. Once it merges, this PR shows only its own commit.

PR Type:

🐞 Bugfix

What changed? 🚀

After one rude edit, every later Hot Reload edit was reported as applied but was lost until the app restarted (Roslyn 5.x). A rejected update no longer moves the Edit-and-Continue baseline: the emit now commits or discards it explicitly. Same change as the master PR; it applies cleanly.

PR Checklist ✅

  • 🧪 Tests included (from the master PR). Uno.HotReload.Tests pass locally (157 passed, 1 Unix-only skipped), and Uno.HotReload builds for net9.0 and net10.0
  • ❗ Contains NO breaking changes

🤖 Generated with Claude Code

kazo0 and others added 9 commits October 14, 2026 18:45
When Roslyn throws while emitting a Hot Reload delta (e.g. dotnet/roslyn#86045),
the pass fell into the manager's catch-all and completed as InternalError. The
EnC baseline does not move, so every later edit failed the same way until the
app restarted, with nothing telling the user that undoing the edit recovers.

Exceptions thrown by EmitSolutionUpdateAsync (cancellation excepted) now
complete the operation as RudeEdit with a synthesized UNOHR0001 diagnostic
asking the user to undo the change or restart the app. The full exception is
still logged at Warn level. Exceptions anywhere else in the pass stay
InternalError.

Fixes #25418

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WjQPjTHecnxjgcqBhM8z3e
(cherry picked from commit 2f6759a)
Adds a Hot Reload Errors section to the error codes page: what the
diagnostic means, that undoing the change or restarting the app
recovers, and the known cause (dotnet/roslyn#86045). Adds UNOHR to the
cSpell word list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WjQPjTHecnxjgcqBhM8z3e
(cherry picked from commit a59b726)
The emit failure now uses Roslyn's ENC1002 ("Cannot apply changes --
unexpected error"), which Roslyn itself uses for an internal error
treated as a blocking rude edit, so no Uno-specific id is needed.

This reverts commit a59b726.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WjQPjTHecnxjgcqBhM8z3e
(cherry picked from commit 2d90b5b)
Roslyn already has an id for this case: ENC1002 ("Cannot apply changes
-- unexpected error"), which EmitSolutionUpdateResults.CreateFromInternalError
uses for an internal error treated as a blocking rude edit. The
synthesized diagnostic now uses it, keeping the message that says how to
recover, and the rude-edit filter is back to accepting ENC ids only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WjQPjTHecnxjgcqBhM8z3e
(cherry picked from commit 855e34d)
ENC ids belong to Roslyn. The synthesized diagnostic goes back to an Uno
id, UNOHR0001, and the rude-edit filter accepts it alongside the ENC ids.

This reverts commit 855e34d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0113rBQqDXVtD6eMXC8Eygn7
(cherry picked from commit 12a7866)
Restores the Hot Reload Errors entry for UNOHR0001 and the UNOHR cSpell
word.

This reverts commit 2d90b5b.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0113rBQqDXVtD6eMXC8Eygn7
(cherry picked from commit d5d3473)
…ied (6.8, backport of #24085)

Backport of #24085 to servicing/6.8, on top of the
backport of #25420 (#25495),
which it builds on. Applies cleanly.

(cherry picked from commit 503b548)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added area/code-generation Categorizes an issue or PR as relevant to code generation area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 1m 54s —— View job


Review complete

  • Gather context (PR diff, AGENTS.md rules)
  • Review Uno.HotReload core changes (HotReloadManager, WatchHotReloadService.Emit, HotReloadEmitResult)
  • Review test coverage changes
  • Review doc/error-code additions
  • Post inline findings
  • Post summary

Verdict: ship — no blocking issues found. No inline comments posted (none warranted).

Summary

This is a faithful cherry-pick of the already-reviewed/merged master fix (#24085) onto servicing/6.8, built on top of the #25420 backport (#25495). I diffed this PR's own commit (9bc003d6) in isolation against the rest of the branch to confirm what's actually new here, since the other two commits belong to the still-unmerged #25495 dependency.

What I checked:

  • Core fix correctness: EnCEngine.EmitAsync (WatchHotReloadService.Emit.cs) now drives Roslyn's internal EnC service directly via reflection instead of the ExternalAccess.UnitTesting wrapper, and explicitly Commits only when Deltas is non-empty, Discards otherwise (including on the exception path while a Ready update is pending). This correctly addresses the root cause (Roslyn 5.x's wrapper auto-committing a rejected rude edit as the next baseline) rather than adding a guard.
  • Version compatibility: servicing/6.8 targets both Roslyn 4.14.0 and 5.6.0 (Uno.DevServer.Roslyn.props), matching the PR's build claim; EngineShape's fail-fast reflection lookups are designed to name the exact missing member if a Roslyn version shifts, so this isn't a silent risk.
  • Test coverage: genuinely strong — RudeEditRecovery tests cover same-edit-reemitted, revert-after-rude-edit, mixed-project rude edits, and edits made while a rude edit is still pending (the exact issue [HotReload] DevServer 7.0.0-dev.2270 keeps a rejected rude edit in its baseline: every later edit is lost (server Success, app applies nothing / InternalError) until the app restarts #25378 scenario). Given_HotReloadManager.EmitFailure.cs reproduces the real Roslyn compiler crash (EnC: adding an async lambda that awaits a dynamic call throws InvalidOperationException in DeltaMetadataWriter.GetFieldDefinitionHandle dotnet/roslyn#86045) end-to-end rather than mocking it. Notably, this change also removes previously-Ignored Scenario.json entries for the When_Base_Type_* metadata-update scenarios, meaning the fix is validated against tests that were skipped specifically because of this bug — good red/fix/green evidence, not guard-only hardening.
  • Backport fidelity: test harness and interface changes (IWatchHotReloadService, EnCHarness, HotReloadManagerHarness) are consistently updated to the new HotReloadEmitResult shape; no leftover references to the old (updates, diagnostics) tuple API.
  • Style: braces, nullable annotations, EventHandler-free (no new events), comments are short and explain non-obvious why (e.g. why discard-vs-commit must happen even on the exception path).

No cross-cutting concerns beyond what's already called out in the PR description (merge-order dependency on #25495, which is not a code defect).

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

@agneszitte

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@agneszitte
agneszitte merged commit b247f69 into servicing/6.8 Nov 3, 2026
53 of 63 checks passed
@agneszitte
agneszitte deleted the dev/agzi/backport-hr-rude-edit-baseline-6.8 branch November 3, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants