Skip to content

fix(hr): don't block hot reload on non-fatal source-generator errors (backport #24012) - #24016

Merged
kazo0 merged 4 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24012
Aug 9, 2026
Merged

kazo0 merged 4 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24012

Conversation

@mergify

@mergify mergify Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Problem

Surfaced by unoplatform/studio.live#3317 (Uno SDK 6.7.0-dev.914 → 6.7.0-dev.938, which moves embedded Roslyn 4.14 → 5.6). The regression guard ReswSupportTests.When_ReswCorruptedDuringHotReload_Then_XamlEditsStillWork passes on 914 and fails on 938.

Root cause. Roslyn 5.x's Edit-and-Continue (UnitTestingHotReloadService.EmitSolutionUpdateAsync) refuses to emit any metadata update while a source generator reports an Error-severity diagnostic — even when the C# compilation itself succeeds. A corrupt .resw makes the Uno XAML generator report UXAML0003 (Error) on every generator pass while the assembly still compiles, so a single broken generator input froze all hot reload (including valid edits to unrelated files) until the .resw was fixed. Roslyn 4.x did not gate on generator diagnostics — hence 914 green, 938 red.

The trap: source-generator diagnostics never appear in Compilation.GetDiagnostics() (only via the internal Project.GetSourceGeneratorDiagnosticsAsync()), so the change-set-scoped blocked-compilation audit (spec 054) can't see them — the pass reports NoChanges, not Failed, and the reason is invisible.

Confirmed with a source-generated-document dump: after the XAML edit with a corrupt .resw, the generated MainPage code does contain the edit (the generator is innocent), yet EnC emits 0 updates while UXAML0003 is present and emits normally once it is gone. (EnC baseline / commitUpdates is not the cause — hot reload recovers as soon as the .resw is valid again.)

Fix

In HotReloadManager.ProcessSolutionChanged, read the change-set projects' source-generator error diagnostics (via Project.GetSourceGeneratorDiagnosticsAsync, resolved through the same ResolveAuditProjects scope as the spec-054 audit) and suppress them for the EnC emit (SpecificDiagnosticOptions → Suppress). A non-fatal generator error then degrades to stale generated output instead of frozen hot reload, restoring 4.x behavior. Generated code that genuinely does not compile still reports a C# (CSxxxx) error and stays blocked through the existing audit / rude-edit paths, so this never lets non-compiling code hot-reload. The bypassed errors are surfaced in the HR log so a broken .resw isn't silent.

The suppression is applied to the emit itself, not as a retry after a blocked emit: EmitSolutionUpdateAsync advances the EnC baseline as a side effect, so a throwaway first emit would consume the change and leave a second nothing to apply.

Also centralizes hot-reload diagnostic reporting — compilation errors, EnC emit diagnostics, solution-update diagnostics, and the new bypassed-generator diagnostics — into a per-cycle DiagnosticsReporter (severity coloring, per-category WASM formatting caps since memory.grow() is irreversible); GetCompilationErrors becomes a pure getter.

Verification

  • studio.live ReswSupportTests — When_ReswCorruptedDuringHotReload + all 4 sibling resw tests pass (Desktop; the Wasm rows are unrelated to this fix — they need the wasm-tools workload to build the sample).
  • Uno.HotReload.Tests — 135/135 pass.

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

dr1rrb and others added 2 commits August 8, 2026 13:46
Roslyn 5.x's Edit-and-Continue refuses to emit any metadata update while a
source generator reports an Error-severity diagnostic, even when the C#
compilation itself succeeds. A corrupt .resw makes the Uno XAML generator
report UXAML0003 (Error) on every pass while the assembly still compiles, so a
single broken generator input froze all hot reload -- including valid edits to
unrelated files -- until it was fixed. Roslyn 4.x did not gate on generator
diagnostics.

Generator diagnostics never appear in compilation.GetDiagnostics() (only via
the internal Project.GetSourceGeneratorDiagnosticsAsync()), so the
change-set-scoped blocked-compilation audit (spec 054) could not see them: the
pass just reported NoChanges, with no visible reason.

Read the change-set projects' source-generator error diagnostics and suppress
them for the EnC emit, so a non-fatal generator error degrades to stale
generated output instead of blocking hot reload. Generated code that genuinely
does not compile still reports a C# error and stays blocked via the existing
audit / rude-edit paths. The suppression is applied to the emit itself, not as
a retry: EmitSolutionUpdateAsync advances the EnC baseline as a side effect, so
a throwaway first emit would consume the change.

Also centralizes hot-reload diagnostic reporting (compilation / emit /
solution-update / the new generator diagnostics) into a per-cycle
DiagnosticsReporter -- severity coloring, per-category WASM formatting caps;
GetCompilationErrors is now a pure getter.

Surfaced by unoplatform/studio.live#3317 (Uno SDK 6.7.0-dev.914 -> dev.938,
embedded Roslyn 4.14 -> 5.6). Verified: studio.live ReswSupportTests
When_ReswCorruptedDuringHotReload now passes (Desktop) with its 4 sibling resw
tests; Uno.HotReload.Tests 135/135.

(cherry picked from commit 3bb2200)
When_Reorder_DragDrop_ScrollsAwayFromDraggedItem_KeepsExtentAndPositions
fails intermittently on the iOS Skia CI leg, always on the mid-drag
extent assertion and always with the same values: ExtentHeight 1560
instead of 1440, exactly 3 phantom 40px rows. Observed on master build
225991 (attempt 1, passed on retry), PR #24007 build 226424, and PR
#24012 build 226524 where 5/5 stage attempts failed on this single test
across different hosted agents.

The identical values every failure point at a timing-dependent residue
of the extent estimation fixed by #23946 surfacing on the iOS simulator
profile — tracked in #24013. Desktop and Android Skia legs keep running
the test, so the regression coverage #23946 added stays in place.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NsWEWZN3E2AtwQm7UU1cFm
(cherry picked from commit c0ce315)

# Conflicts:
#	src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_ListViewBase.cs
@mergify mergify Bot added the conflicts Automated merge hit conflicts label Aug 8, 2026
@mergify

mergify Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of c0ce315 has failed:

On branch mergify/bp/release/stable/6.7/pr-24012
Your branch is ahead of 'origin/release/stable/6.7' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit c0ce315db5.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_ListViewBase.cs

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@kazo0
kazo0 enabled auto-merge August 8, 2026 20:40
@kazo0

kazo0 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@kazo0

kazo0 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@Mergifyio rebase

@mergify

mergify Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

rebase

☑️ Nothing to do, the required conditions are not met

Details
  • any of:
    • #commits-behind > 0 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]
  • -closed [📌 rebase requirement]
  • -conflict [📌 rebase requirement]
  • queue-position = -1 [📌 rebase requirement]

@kazo0
kazo0 disabled auto-merge August 8, 2026 21:02
@kazo0 kazo0 removed the conflicts Automated merge hit conflicts label Aug 8, 2026
@kazo0
kazo0 enabled auto-merge August 8, 2026 21:51
@kazo0

kazo0 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@Mergifyio rebase

@mergify

mergify Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

rebase

☑️ Nothing to do, the required conditions are not met

Details
  • any of:
    • #commits-behind > 0 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]
  • -closed [📌 rebase requirement]
  • -conflict [📌 rebase requirement]
  • queue-position = -1 [📌 rebase requirement]

@kazo0

kazo0 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

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

@kazo0
kazo0 merged commit a3d0321 into release/stable/6.7 Aug 9, 2026
80 of 84 checks passed
@kazo0
kazo0 deleted the mergify/bp/release/stable/6.7/pr-24012 branch August 9, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants