Repository navigation
fix(hr): report suppressed source-generator errors on the operation (backport #24025) - #24035
Merged
dr1rrb merged 1 commit intoAug 11, 2026
Merged
Conversation
#24012 suppresses source-generator errors for the EnC emit so a non-fatal generator error degrades to stale generated output instead of freezing hot reload. It reports them to the console, but `diagnostics` is then assigned `emitDiagnostics` outright, so they never reach the operation consumers see. That loses the only actionable message for the file the user just edited. Invalid XAML reports UXAML0001 among the generator errors, while the emit — handed a degraded generated tree — reports a rude edit such as ENC0020 "Renaming method 'IMainPage_Bindings.UpdateResources()' requires restarting the application", naming generated code the user never wrote. Consumers were shown only the misleading half. Carry the suppressed generator errors alongside the emit diagnostics. No dedup is required, unlike the compilation-error FIXME below it: generator diagnostics never appear in compilation.GetDiagnostics(), so they cannot already be present in emitDiagnostics. They are also already scoped to the change set's projects via auditedProjects. Fixes #24022 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> (cherry picked from commit 67e44b2)
dr1rrb
enabled auto-merge
August 10, 2026 21:04
dr1rrb
approved these changes
Aug 10, 2026
kazo0
approved these changes
Aug 10, 2026
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-24035/wasm-skia-net9/index.html |
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.
Fixes #24022
Problem
#24012 suppresses source-generator errors for the EnC emit so a non-fatal generator error degrades to stale generated output instead of freezing hot reload — that part works. It reports them via
diagnosticsReporter.ReportAnalyzerDiagnostics(generatorErrors), which routes toIReporter.Verbose. But a few lines later:assigns outright, so the suppressed generator errors never reach the operation's
diagnostics— the collection consumers actually read.For a broken input outside the change set (the corrupt
.reswcase #24012 targets) that is harmless. For the file the user just edited it removes the only actionable message:while the real error exists but is confined to the trace:
So a user who mistypes XAML is told a generated
IMainPage_Bindingsmember was renamed — code they never wrote and cannot see — instead of the line and column of their typo.Fix
Carry the suppressed generator errors alongside the emit diagnostics:
The suppression still applies to the emit — hot reload keeps running, which is #24012's behaviour — but the diagnostics are no longer dropped from what is reported.
No dedup required, unlike the compilation-error
FIXMEa few lines below ("Needs dedup before fixing"): generator diagnostics never appear incompilation.GetDiagnostics(), so they cannot already be present inemitDiagnostics. The two sets are disjoint by construction.Scope is already correct:
generatorErrorscomes fromGetGeneratorErrorsAsync(auditedProjects, …), already limited to the change set's projects (spec 054), so this does not surface errors from projects the pass never touched.The
ENCdiagnostic is retained, not replaced — consumers get both the rude-edit reason and the generator error that caused it.Alternative considered
The issue suggested only suppressing diagnostics whose source file is outside the change set, which would separate the two cases at file granularity. I did not take that: it changes the suppression semantics #24012 deliberately chose, whereas this change only fixes the reporting, which is the actual defect. If you would rather have the finer-grained suppression, this PR does not conflict with it.
Verification
dotnet build src/Uno.HotReload/Uno.HotReload.csproj -c Debug— succeeds, 0 warnings, 0 errors.operation.DiagnosticscontainsUXAML0001and theENCrude-edit diagnostic, where today it contains only the latter.🤖 Generated with Claude Code
This is an automatic backport of pull request #24025 done by Mergify.