Repository navigation
fix(hr): don't block hot reload on non-fatal source-generator errors (backport #24012) - #24016
Merged
Merged
Conversation
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
Contributor
Author
|
Cherry-pick of c0ce315 has failed: 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 |
ajpinedam
approved these changes
Aug 8, 2026
kazo0
enabled auto-merge
August 8, 2026 20:40
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
@Mergifyio rebase |
Contributor
Author
☑️ Nothing to do, the required conditions are not metDetails
|
kazo0
disabled auto-merge
August 8, 2026 21:02
kazo0
enabled auto-merge
August 8, 2026 21:51
nickrandolph
approved these changes
Aug 9, 2026
Contributor
|
@Mergifyio rebase |
Contributor
Author
☑️ Nothing to do, the required conditions are not metDetails
|
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24016/wasm-skia-net9/index.html |
Contributor
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Surfaced by unoplatform/studio.live#3317 (Uno SDK
6.7.0-dev.914→6.7.0-dev.938, which moves embedded Roslyn4.14→5.6). The regression guardReswSupportTests.When_ReswCorruptedDuringHotReload_Then_XamlEditsStillWorkpasses on914and fails on938.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.reswmakes the Uno XAML generator reportUXAML0003(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.reswwas fixed. Roslyn 4.x did not gate on generator diagnostics — hence914green,938red.The trap: source-generator diagnostics never appear in
Compilation.GetDiagnostics()(only via the internalProject.GetSourceGeneratorDiagnosticsAsync()), so the change-set-scoped blocked-compilation audit (spec 054) can't see them — the pass reportsNoChanges, notFailed, and the reason is invisible.Confirmed with a source-generated-document dump: after the XAML edit with a corrupt
.resw, the generatedMainPagecode does contain the edit (the generator is innocent), yet EnC emits 0 updates whileUXAML0003is present and emits normally once it is gone. (EnC baseline /commitUpdatesis not the cause — hot reload recovers as soon as the.reswis valid again.)Fix
In
HotReloadManager.ProcessSolutionChanged, read the change-set projects' source-generator error diagnostics (viaProject.GetSourceGeneratorDiagnosticsAsync, resolved through the sameResolveAuditProjectsscope 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.reswisn't silent.The suppression is applied to the emit itself, not as a retry after a blocked emit:
EmitSolutionUpdateAsyncadvances 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);GetCompilationErrorsbecomes a pure getter.Verification
ReswSupportTests—When_ReswCorruptedDuringHotReload+ all 4 sibling resw tests pass (Desktop; the Wasm rows are unrelated to this fix — they need thewasm-toolsworkload 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).