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
Razor C# features answer nothing when the project's SDK is newer than the sidecar's Roslyn #399
A Razor file's C# projection comes from the Razor source generator of the SDK that resolves for its project. With no global.json, that is the newest installed SDK. If that SDK's generator was built against a newer Roslyn than the one the sidecar bundles, Roslyn refuses to load it. The Razor file then gets no projection:
hover, definition, completion and diagnostics answer nothing inside its C#;
.cs files that use its generated components report CS0246.
The sidecar bundles Roslyn 5.6. SDK 10.0.303's Razor generator references Roslyn 5.5, and SDK 10.0.4xx's references a newer one.
How it showed up
CI runners carry SDK 10.0.401 alongside the repository's 10.0.303 pin. The Razor end-to-end suites (Rust and VS Code) copy their fixture to a temp folder that has no global.json. On both Linux and Windows, every hover in a Razor file was null and Program.cs reported CS0246 for the generated App component. Keeping the repository's pin in those copies (#398) makes the tests deterministic, but users with a newer SDK are still affected.
Expected
Razor C# features work whichever SDK the project resolves, or the server says why they cannot.
Options
Load the Razor generator from the copy the sidecar bundles, which matches its Roslyn, whatever SDK the project uses.
Resolve design-time builds to the SDK whose Roslyn the sidecar matched, when no global.json says otherwise.
At least log it and show a warning that names the SDK and Roslyn versions.
Activity
The Rust Razor fixture keeps the repository's SDK pin in its scratch …
Razor foundation: Blazor components, Razor Pages and MVC views in the…
Prove Razor C# features with a newer SDK's Razor generator (#399)
Newer SDKs work without a pin (#399): the Blazor docs and post explai…
Razor plan: SDK 10.0.401's compiler confirms the #399 root cause, and…