Skip to content

Re-enable the hot-reload MetadataUpdate test suite (Roslyn 5.x migration + snapshot regeneration) #24071

Closed

Description

@dr1rrb

What is broken

The MetadataUpdate hot-reload suite in Uno.UI.SourceGenerators.Tests — the only end-to-end workbench we have for XAML codegen × Edit-and-Continue — does not run at all on master. It is not failing; it is not compiled.

src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Uno.UI.SourceGenerators.Tests.csproj:

<!-- Disabled until the net10 Roslyn 5.x migration (follow-up PR): these consume Uno.HotReload
     (5.x), incompatible with the temporary 4.14.0 pin. -->
<Compile Remove="MetadataUpdateTests\Given_HotReloadService.cs" />
<Compile Remove="MetadataUpdates\HotReloadWorkspaceProvider.cs" />

…plus the Uno.HotReload ProjectReference commented out further down, and Microsoft.CodeAnalysis pinned back to 4.14.0 with a TEMPORARY marker.

Verified on master @ e34e85017b:

  • Uno.UI.SourceGenerators.Tests discovers 232 tests, zero of them the HR scenario test. The ~30 scenario folders under MetadataUpdateTests/Scenarios/ are still copied to the output directory, so nothing signals that they stopped executing.
  • Uno.HotReload.Tests (the other suite, unaffected) is healthy: 146/146 green in 4.5 s on Linux against the net10 / Roslyn 5.6 embed.

How it got here

Disabled in ea42f022c5 (2026-07-28) as a deliberate, separately-committed consequence of spec 053 R2 (PR #23863): NuGet cannot restore a 4.14-pinned test project against the 5.6-pinned Uno.HotReload (NU1107). The spec states the intent explicitly:

The follow-up PR migrates the test project to 5.x, regenerates the snapshot baselines (checksum algorithm SHA1→SHA256 and generated-file ordering changed; the regeneration harness is Windows-only), and re-enables the suite; the branch with the 5.x re-enable groundwork is prepared.

That follow-up PR was never opened, and nothing tracked it — hence this issue.

Why this is urgent now

This suite is the workbench needed to work on unoplatform/uno.hotdesign#7669 / dotnet/roslyn#77224 — ENC1002 / ArgumentException: An item with the same key has already been added. Key: …DeletedPEMethodDefinition when a XAML edit deletes generated lambdas. Roslyn only builds DeletedPEMethodDefinition for deleted synthesized methods (GetDeletedSynthesizedMethods), so the trigger is our generated closures disappearing — precisely what these scenarios exercise, and precisely the kind of thing we have historically fixed by reshaping codegen (e.g. 9ca0256d00, which moved ComponentHolder out of field-initializer position for exactly this class of reason).

Two concrete consequences of the suite being off:

  1. We cannot iterate on docs: Update vs2022 getting started #7669 headlessly. With the suite running, a scenario folder is 5 files and the crash surfaces as a plain test failure — HotReloadWorkspace.Update() calls EmitSolutionUpdateAsync with no try/catch, so the Roslyn exception propagates with its real stack. Without it, the only repro path is Windows + VS + a running app.
  2. When_Page_Res_xBind_Remove cannot be re-examined. That scenario is already flagged "IsCrashingRoslyn": true and skipped via Assert.Inconclusive. Its step 0 has Color="{x:Bind MyColor}", step 1 replaces it with a literal — i.e. it deletes generated lambdas, the same shape as docs: Update vs2022 getting started #7669. It may well be the same crash, already sitting in our tree, and we currently have no way to check.

Beyond #7669: the whole XAML-codegen × EnC surface has had no CI coverage since 2026-07-28. Any hot-reload codegen regression landing in that window is unguarded.

What needs to be done

  • Migrate Uno.UI.SourceGenerators.Tests to the net10 / Roslyn 5.x line (drop the TEMPORARY 4.14.0 pin).
  • Regenerate the committed source-generator snapshot baselines — the checksum algorithm changed SHA1→SHA256 and generated-file ordering changed. Note: the regeneration harness is Windows-only.
  • Restore the two Compile Removed files and the Uno.HotReload ProjectReference.
  • Land the prepared 5.x re-enable groundwork branch mentioned in spec 053.

Acceptance criteria

  • Given_HotReloadService.HR is discovered and runs — the ~30 existing scenarios execute in CI, on the same Roslyn line the dev-server host embeds (5.6 for net10).
  • Snapshot tests pass without local regeneration.
  • A CI guard (or a test) fails if the suite silently stops being discovered again — the current failure mode was invisible because the scenario data kept being copied to the output directory.
  • When_Page_Res_xBind_Remove is re-run with IsCrashingRoslyn removed and the outcome recorded: either it passes, or its exception is captured and linked to EnC: ArgumentException: An item with the same key has already been added. dotnet/roslyn#77224.

Anything else

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/hot-reloadarea/tests 🧪kind/regression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions