Skip to content

Hot reload: suppressing source-generator errors for the EnC emit also removes them from reported diagnostics (UXAML0001 replaced by ENC0020) #24022

Closed

Description

@nickrandolph

@dr1rrb — follow-up to #24012, which I confirmed fixes the case it targeted. This is about a side effect of the suppression.

Summary

#24012 suppresses source-generator error diagnostics for the EnC emit so a broken input (e.g. a corrupt .resw) degrades to stale generated output instead of freezing hot reload. That works. But the suppression also removes those diagnostics from what the hot-reload operation reports, so when the file the user just edited is itself invalid, the actionable error is replaced by a misleading one.

Observed

Editing MainPage.xaml into malformed XAML, then running a hot-reload cycle:

HR result: RudeEdit, Diagnostics: 1
DIAG: …/Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator/MainPage_eb076510….cs(156,4):
      error ENC0020: Renaming method 'IMainPage_Bindings.UpdateResources()' requires restarting the application.

The real error is still produced — it appears in the build trace:

…/Presentation/MainPage.xaml(6,2): error UXAML0001: Name cannot begin with the '<' character,
   hexadecimal value 0x3C. Line 6, position 2.

…but it never reaches the operation's diagnostics. The generator, given invalid XAML, emits degraded code that differs structurally enough to trip a rude edit, and that is what surfaces.

So a user who mistypes XAML is told "Renaming method IMainPage_Bindings.UpdateResources() requires restarting the application" — naming generated code they never wrote and never see — instead of "line 6, position 2: name cannot begin with '<'".

The Failed/RudeEdit outcome itself is still correct; only the reported diagnostic regressed.

Before / after

case broken file in the change set? before #24012 after
corrupt .resw, edit an unrelated .xaml Resources.resw no ❌ hot reload frozen ✅ proceeds — the fix
edit MainPage.xaml invalidly MainPage.xaml yes ✅ UXAML0001 surfaced ⚠️ replaced by ENC0020

Suggested refinement

Suppress the generator error's blocking effect while still surfacing it — or, if the blocking and reporting paths can't be separated cleanly, only suppress diagnostics whose source file is outside the change set. The change-set membership above is a clean discriminator between the two cases and preserves #24012's fix intact.

Repro

  1. Take a project with a MainPage.xaml.
  2. Overwrite it with malformed XAML (e.g. an unclosed element).
  3. Run a hot-reload cycle and inspect the operation's diagnostics.

Expected: a diagnostic identifying the XAML syntax error.
Actual: ENC0020 naming a generated IMainPage_Bindings member.

Impact

A downstream consumer has a runtime test asserting UXAML0001 appears in the hot-reload operation's diagnostics; it fails deterministically on Uno SDK 6.8.0-dev.6 (3/3 CI attempts, Desktop and Wasm) and passes on 6.7.0-dev.938. Beyond the test, the user-facing effect is that a XAML typo during hot reload no longer says what is wrong or where.

Activity

  1. added a commit that references this issue on Aug 10, 2026
    67e44b2
  2. added a commit that references this issue on Aug 11, 2026
    ccfa10e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions