Skip to content

fix(hr): report a compiler crash during the delta emit as a rude edit (backport #25420) - #25495

Merged
agneszitte merged 8 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-25420
Nov 3, 2026
Merged

agneszitte merged 8 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-25420

Conversation

@mergify

@mergify mergify Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25418

PR Type:

🐞 Bugfix

What changed? 🚀

When Roslyn throws while emitting a Hot Reload delta, HotReloadManager completed the operation as InternalError through the pass's catch-all. The EnC baseline doesn't move, so every later edit hit the same crash and also reported InternalError until the app restarted. Nothing told the user that undoing the edit recovers. The current trigger is dotnet/roslyn#86045, which MVUX's generated code hits when a command's parameters change (MVUX workaround: unoplatform/uno.extensions#3227).

  • Exceptions from _watchService.EmitSolutionUpdateAsync only, except cancellation of the pass's token, now complete the pass as RudeEdit, with one synthesized diagnostic, UNOHR0001 ("Hot Reload update could not be emitted"). It is an Uno id because ENC ids belong to Roslyn. The message says how to recover:
    "The compiler could not produce a Hot Reload update for this change (). Undo the change to keep going, or restart the app."
  • The catch uses the filter Roslyn puts around its own CreateFromInternalError calls, where FatalError.ReportAndCatchUnlessCanceled lets an OperationCanceledException through only when the passed token is cancelled: catch (Exception e) when (e is not OperationCanceledException || !ct.IsCancellationRequested). A cancellation exception thrown by the emit while ct is not cancelled is a compiler failure like any other.
  • The full exception is logged at Warn, so compiler bugs stay visible in the log.
  • The rude-edit filter also accepts this diagnostic, next to the ENC ids, so it takes the existing rude-edit path: reporter, operation diagnostics, handler.
  • Exceptions anywhere else in the pass still end as InternalError.

Clients already treat RudeEdit as "this edit needs a restart", so IDEs and the App MCP react correctly without changes. The App MCP's wording for this case is in unoplatform/uno.app-mcp#203 and #204.

Test: Given_HotReloadManager.EmitFailure runs a real HotReloadManager over EnCHarness (the real Roslyn EnC pipeline, no stubbed emitter), with the code shape from dotnet/roslyn#86045:

  1. The crashing edit gives RudeEdit, a single UNOHR0001 diagnostic, no deltas, and the Warn log.
  2. Undoing it gives NoChanges.
  3. A valid edit gives Success with one delta.

It fails with InternalError before the fix. EnCHarness.CreateAsync gained optional baseline-source and extra-reference parameters; dynamic needs Microsoft.CSharp, System.Linq.Expressions and System.Runtime.

Verified end to end: I swapped this Uno.HotReload.dll into a 7.0.0-dev.2270 DevServer host; no commits touch src/Uno.HotReload between that build and this branch's base. I then ran the repro on a recommended-preset MVUX app on Skia desktop:

  1. Add a state: applied.
  2. Change the command's signature: RudeEdit with the diagnostic above. It used to be InternalError.
  3. Undo it: NoChanges.
  4. Edit the command's body: applied, and the new code runs.

Notes:

  • I built and ran the tests on net10.0 (-p:NetCurrent=net10.0 -p:NetPrevious=net9.0), because the machine has no .NET 11 SDK. Roslyn is 5.6.0 for both TFMs.

PR Checklist ✅

  • 🧪 Added tests (src/Uno.HotReload.Tests; that project: 148 passed, 1 skip that was already there)
  • 📚 Docs have been added/updated (UNOHR0001 in doc/articles/uno-build-error-codes.md, under a new Hot Reload Errors section; UNOHR added to the cSpell word list)
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes

🤖 Generated with Claude Code

https://claude.ai/code/session_01WjQPjTHecnxjgcqBhM8z3e


This is an automatic backport of pull request #25420 done by [Mergify](https://mergify.com).

kazo0 and others added 7 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)
@github-actions github-actions Bot added area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation labels Oct 14, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 239573 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

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

@agneszitte

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@unodevops

Copy link
Copy Markdown
Contributor

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

@unodevops

Copy link
Copy Markdown
Contributor

@agneszitte
agneszitte merged commit 7cad626 into servicing/6.8 Nov 3, 2026
44 of 62 checks passed
@agneszitte
agneszitte deleted the mergify/bp/servicing/6.8/pr-25420 branch November 3, 2026 07:00
ajpinedam pushed a commit to ajpinedam/uno that referenced this pull request Nov 3, 2026
…ied (6.8, backport of unoplatform#24085)

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

(cherry picked from commit 503b548)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants