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
{{ message }}
Repository navigation
𦨠[HR] Workspace selects analyzer flavors for the SDK compiler, not its embedded Roslyn β generators silently missingΒ #23860
The dev-server's hot-reload workspace loads projects with the machine's SDK but compiles
them with the NuGet-pinned Microsoft.CodeAnalysis embedded in the dev-server (4.13 on the
net9 host flavor, 4.14 on net10). Analyzer packages that multi-target Roslyn
(analyzers/dotnet/roslyn{X.Y}/β¦) get their flavor selected by the SDK compiler's CompilerApiVersion (the .NET 10 SDK's csc is Roslyn 5.6) β not by the Roslyn that
actually runs the generators.
Concretely, with CommunityToolkit.Mvvm 8.4.2 on a .NET 10 SDK machine, the design-time
build selects analyzers/dotnet/roslyn5.0/cs/CommunityToolkit.Mvvm.SourceGenerators.dll,
which cannot type-load against CodeAnalysis 4.14 (ReflectionTypeLoadException, 48 loader
exceptions). AnalyzerFileReference.GetGenerators("C#")silently returns 0 generators
β no exception, no CS8784/CS8785 β so every workspace compile of a project using [ObservableProperty]/[RelayCommand] is missing its generated members (measured: 229
phantom errors on a single library β orphaned CS0759 partial methods, CS0103/CS1061
on the generated properties). Any pipeline step that compiles such a project then fails a
hot reload that actually applied (see #23861).
Generators shipping only β€ roslyn4.x flavors (Uno.UI.SourceGenerators, PolySharp,
Microsoft.Extensions.*) load fine, which makes the failure look package-specific and very
hard to diagnose β nothing is logged anywhere.
Expected behavior
The workspace pins the analyzer flavor selection to its embedded Roslyn: pass CompilerApiVersion = roslyn{Major}.{Minor} (computed at runtime from typeof(Compilation).Assembly) as an MSBuild global property in CompilationWorkspaceProvider. Verified empirically: the selected flavor flips to roslyn4.12, 7 generators load, and the 229-error library compiles clean.
The embedded Roslyn is bumped per host flavor to match the served SDK line: net9 β
latest 4.x (4.14.0), net10 β latest 5.x (5.6.0) β also brings C# 14 parsing for
net10+ apps.
When an analyzer still fails to load, the workspace logs one warning per (project,
analyzer) stating which project is impacted and that hot reload will NOT work for
it β instead of today's silence followed by a multi-thousand-line error dump.
Environment
Dev-server host net10.0 flavor (SDK 10.0.x, csc Roslyn 5.6), Microsoft.CodeAnalysis
4.14 embedded, CommunityToolkit.Mvvm 8.4.2. Applies to any analyzer package shipping a roslyn5.x flavor.
changed the title [-][HR] Workspace selects analyzer flavors for the SDK compiler, not its embedded Roslyn β generators silently missing[/-][+]𦨠[HR] Workspace selects analyzer flavors for the SDK compiler, not its embedded Roslyn β generators silently missing[/+]on Jul 31, 2026
Activity
[-][HR] Workspace selects analyzer flavors for the SDK compiler, not its embedded Roslyn β generators silently missing[/-][+]𦨠[HR] Workspace selects analyzer flavors for the SDK compiler, not its embedded Roslyn β generators silently missing[/+]