You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Roslyn closed both issues as Resolution-External. The maintainer diagnosis on #84569 was:
The root cause of the problem is that the source generator is non-deterministic.
This therefore needs a canonical MAUI-side blocker rather than being considered fixed because the Roslyn issue is closed.
Why this is a P0 blocker
This blocks trustworthy validation of the .NET 11 Preview 7 opt-in XAML SourceGen/Incremental Hot Reload feature:
A first XAML update can succeed, while a later update crashes Roslyn's EnC delta emitter.
The failure affects the core repeated-edit workflow that Hot Reload must support.
It can affect both Visual Studio and VS Code because both consume the generated code through Roslyn EnC.
A closed Roslyn issue currently gives a false impression that the defect was fixed.
Scope is intentionally narrow: this blocks the opt-in .NET 11 XAML SourceGen/Incremental path. It is not evidence that Legacy/default XAML Hot Reload is broken.
Root cause
The Incremental XAML Hot Reload generator can emit UpdateComponent() only in an EnC delta rather than in generation 0. On a later generation, Roslyn can no longer map that delta-added method:
UpdateComponent() is introduced in generated *.xaml.uc.xsg.g.cs output after the baseline.
A subsequent generator output does not deterministically preserve/re-emit the method.
Roslyn's definition mapping loses the corresponding EmitBaseline.MethodsAdded entry.
A later update/delete reaches DefinitionMap.GetPreviousMethodHandle, which cannot resolve the previous method and throws.
The MAUI generator must produce stable output across every generation, including C#-only edits, invalid/intermediate XAML, structural resets, and no-op patches.
Steps to reproduce
Use the minimal reproduction and diagnostic logs from:
No ENC1002, GetPreviousMethodHandle exception, stale generator state, or memory retention across repeated sessions.
Version and platforms
Version: .NET 11 Preview 7 / MAUI net11.0 CI builds with Incremental XAML Hot Reload enabled.
Platforms: generator/EnC-layer issue; potentially cross-platform. The Roslyn repro used Windows, while related SourceGen repeated-edit failures have also been observed on Android.
Description
.NET 11 Preview 7's opt-in Incremental XAML Hot Reload / XAML SourceGen path can fail on a subsequent Hot Reload update with:
The complete minimal analysis and EnC logs are in:
GetPreviousMethodHandlefails for a delta‑added source‑generated method on a later update (MethodsAddedtracking lost across generations) roslyn#84569DefinitionMap.GetPreviousMethodHandledeleting a delta-added source-generated method (MAUI XAML SourceGenUpdateComponent) roslyn#84560Roslyn closed both issues as
Resolution-External. The maintainer diagnosis on #84569 was:This therefore needs a canonical MAUI-side blocker rather than being considered fixed because the Roslyn issue is closed.
Why this is a P0 blocker
This blocks trustworthy validation of the .NET 11 Preview 7 opt-in XAML SourceGen/Incremental Hot Reload feature:
Scope is intentionally narrow: this blocks the opt-in .NET 11 XAML SourceGen/Incremental path. It is not evidence that Legacy/default XAML Hot Reload is broken.
Root cause
The Incremental XAML Hot Reload generator can emit
UpdateComponent()only in an EnC delta rather than in generation 0. On a later generation, Roslyn can no longer map that delta-added method:UpdateComponent()is introduced in generated*.xaml.uc.xsg.g.csoutput after the baseline.EmitBaseline.MethodsAddedentry.DefinitionMap.GetPreviousMethodHandle, which cannot resolve the previous method and throws.The MAUI generator must produce stable output across every generation, including C#-only edits, invalid/intermediate XAML, structural resets, and no-op patches.
Steps to reproduce
Use the minimal reproduction and diagnostic logs from:
dotnet/roslyn#84569
At a high level:
Use a .NET 11 Preview 7 MAUI app with XAML SourceGen/Incremental Hot Reload enabled:
Start a managed Hot Reload session.
Apply the first XAML update that introduces the generated patch method.
Apply subsequent XAML and/or interleaved C# updates.
Observe
ENC1002and theGetPreviousMethodHandleexception on a later update.Expected behavior
Every subsequent XAML or interleaved C# update applies successfully. Generated patch methods retain deterministic identity across all EnC generations.
Actual behavior
A later update fails in Roslyn's EnC delta emitter because a previously delta-added generated method can no longer be resolved.
Current fix status
No fix is merged or shipped as of 2026-07-27:
net11.0.net11.0, but closed unmerged.net11.0generator state does not contain theUpdateComponent()lifetime/stability tracking proposed by [XAML HR] Keep UpdateComponent() stable across generations to avoid E… #36680.Related issues that should remain separate
DataTemplateedits and unstable synthesized closure/lambda identity.dotnet watchHot Reload failures with a similar Roslyn stack, but a different surface and ownership path.Suggested fix direction
Revive the intent of #36680 while addressing its review concerns:
UpdateComponent()across all generator branches;Exit criteria
net11.0.ENC1002,GetPreviousMethodHandleexception, stale generator state, or memory retention across repeated sessions.Version and platforms
net11.0CI builds with Incremental XAML Hot Reload enabled.