Repository navigation
fix(hr): Embed Roslyn 5.12 in the net11 dev-server - #26318
Conversation
Plans aligning the net11 dev-server host with the SDK 11 compiler (Roslyn 5.12) and the checks carried over from the spec 053 bump. Refs #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDK 11.0.100 defaults net11.0 projects to C# 15, which the embedded Roslyn 5.6 cannot parse: any C# 15 syntax blocked every hot reload of the project. 5.12 is not on nuget.org yet, so the exact SDK build comes from the dotnet-tools feed. Microsoft.Extensions pins are raised to the floor 5.12 requires, for the dev-server projects only. Fixes #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The workspace drops a /langversion the embedded Roslyn cannot parse without any diagnostic. Warn once per project whose target framework defaults to a newer C# than the embedded compiler, and add a guard test that the embedded Roslyn accepts the SDK's default C# version. Refs #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
HRApp inherited LangVersion 13.0, so the end-to-end hot reload tests could not catch a dev-server compiler older than the SDK default. Refs #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The feed in NuGet.Config made every restore in the repository depend on it, for a pin only the net11 dev-server needs. It now comes from RestoreAdditionalProjectSources in the net11 block of Uno.DevServer.Roslyn.props, which the projects restoring Roslyn 5.12 import; Uno.HotReload.Tests now imports it too. Refs #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The load-time warning was the only line naming the cause, while every blocked edit listed only compile errors the build does not have. A blocked reload of a project whose target framework defaults to a C# version above the embedded compiler is now followed by a hint saying so. The check also covers LangVersion=preview, reuses the existing target-framework parser, honors cancellation and logs the exception type when it fails. Refs #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describes the scoped feed, the blocked-reload hint and the case R5 cannot detect, and replaces the status table with the unit, restore, build and runtime results on SDK 11.0.100. Refs #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The HRApp tests only recompiled CSharpLatestSyntax.cs around other edits. This test edits the method that uses a labeled continue and checks the new body runs, so a dev-server compiler older than the SDK default fails it directly. Passes on Roslyn 5.12, fails on 5.6 with the issue's errors. Refs #26316 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The build 245527 found UI Test snapshots differences: Details
|
|
An independent check of this PR, plus the history of our past Roslyn bumps, so @carldebilly can decide about the feed. Verdict: the fix holds up. Roslyn 5.9 isn't enough; Hot Reload needs 5.12. Tests (2026-11-11, head
End to end: the issue's own repro (SDK 11.0.100, Windows, desktop)
Setup for the second run: the app used this PR's Uno packages through History
When 5.12 reaches nuget.org
Decision for @carldebilly: ship 7.0 SR1 with |
|
Thanks @agneszitte, this matches what we've done for every new .NET release. Decision: ship 7.0 SR1 with We keep the embedded Roslyn conservative so users are never forced to update their tooling early. When we add a new target framework, that target's host can move to the compiler of the SDK it serves. The existing ones stay put, as the net9 and net10 hosts do here. Precedent: the dev-server's embedded Roslyn at each .NET release
The first metadata-update hot reload (#7564, 2021) also started on The only new part here is where the package comes from. The |
carldebilly
left a comment
There was a problem hiding this comment.
Approving: the fix does what #26316 asks. The net11 host now compiles with the exact Roslyn build SDK 11.0.100 ships, the net9 and net10 hosts are unchanged, the feed is scoped to the four projects that restore this line, and the new warning, hint and guard tests cover the next time a host falls behind its SDK. The prerelease Roslyn from dotnet-tools is the decision recorded above, with the switch to nuget.org tracked in #26328.
The inline comments are non-blocking suggestions, each with a ready-to-apply change:
- Medium: the blocked-reload hint only reaches the dev-server console. It should also go into the operation's diagnostics, so the IDE, the in-app indicator and
uno_app_hot_reload_statusshow the reason. I applied the patch locally on5bcf4c34and ran theGiven_HotReloadManagerandGiven_EmbeddedRoslyntests: 44 passed. The new assertion fails without the change ("the collection is empty"). - Medium: the hint says why the reload is blocked but not what to do about it.
- Low: the spec still lists settled points as open questions, and the follow-up isn't linked yet.
- Low: the spec presents G2 as a guardrail, but no CI job runs HRApp.
Smaller items, each with its fix
EmbeddedRoslyn.cs:97-110:latest,latestMajor,previewordefaulton a target framework the host supports, built by a newer SDK, compiles newer C# and goes undetected. Example:net11.0with<LangVersion>latest</LangVersion>on SDK 12. Detecting that needs the SDK version, which the workspace doesn't expose, so documenting it is enough for now.- Append to the spec's R5 "Not detected" paragraph (line 140): "Also not detected:
latest,latestMajor,previewordefaulton a target framework whose default the embedded compiler supports, built by a newer SDK (net11.0withlateston SDK 12). These resolve against the build's compiler, which the workspace does not expose."
- Append to the spec's R5 "Not detected" paragraph (line 140): "Also not detected:
EmbeddedRoslyn.cs:77: addreporter.Verbose(e.ToString());after the sweep-failure warning, so an unexpected Roslyn exception can be traced to where it was thrown.spec.md:81-82: in the R3 table, replacecheckwithnot centrally pinned; resolves transitivelyandfinewithsatisfied by R2.Uno.UI.RuntimeTests.HRApp.csproj:20: say "the repo-wideLangVersion(src/Directory.Build.props)" instead of "the repo's 13.0", so the comment doesn't go stale on the next bump.Uno.DevServer.Roslyn.props:28: the feed applies to every package these four projects restore, not only Roslyn. Keeping the per-project scoping over a repo-widepackageSourceMappingis the right trade-off here (spec R1), and linking #26328 in the comment covers its removal.
Style nits
EmbeddedRoslyn.cs:127-130: the3and4are"net".Length. Useconst string NetPrefix = "net";withNetPrefix.Lengthin the guard and inAsSpan.EmbeddedRoslyn.cs:48: add// LanguageVersion encodes major * 100 + minor (CSharp14 = 1400), so integer division yields the major.CSharpLatestSyntax.cs:7: the method only uses a labeledcontinue, so use// Labeled continue: C# 15.
The blocked-reload hint only reached the dev-server console. It is now
also a UNOHR0002 warning in the operation's diagnostics, so the IDE, the
in-app indicator and uno_app_hot_reload_status show why the reload
failed, not only "Failed". The new assertion fails without the
HotReloadManager change ("the collection is empty").
The negative test now matches "supports up to C#", which the positive
test also checks, so rewording the hint cannot empty it silently.
Review: #26318 (comment)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every blocked edit now repeats the fix ("Update Uno.Sdk, or set
<LangVersion>…"), which only the load-time warning gave before. That
warning now says Uno.Sdk instead of "the Uno Platform packages": in an
Uno.Sdk project there is no dev-server package reference to bump.
Also from the review: log the language-version sweep's exception at
Verbose, name the "net" prefix length, explain the LanguageVersion
division, and reword two comments that would go stale.
Review: #26318 (comment)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
7.0 SR1 ships the net11 host on the dotnet-tools build of Roslyn 5.12; the switch to the nuget.org 5.12.0 is tracked in #26328, now linked from the props comment and the spec. The open questions become decisions. The status table records the CI package inspection and the issue's end-to-end repro. R5, G2 and G3 describe UNOHR0002, the undetected "latest on a newer SDK" case, and that no CI job runs HRApp yet. Review: #26318 (review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
This pull request is merged. |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-26318/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
A reload blocked by a XAML generator error got no C# version hint, only the compile-error path had it. Such an error, like an unresolved x:Bind member, can come from code-behind the embedded compiler cannot parse, so that blocked line now gets the same hint and UNOHR0002 diagnostic, for the change-set's projects. Both paths share one helper, which never fails the pass it explains: an exception computing the hint is logged at Verbose and the pass stays blocked. The new test fails without the generator-path change (only UXAML0001 is reported). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The load warning and the blocked-reload hint built the same "Update Uno.Sdk, or set <LangVersion>" sentence separately. One property now serves both, so the two messages cannot drift. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds [GitHubWorkItem] for #26316 to Given_CSharpLatestSyntax, as the runtime-test rules ask for tests that guard an issue. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Addresses two code-quality findings on Given_CSharpLatestSyntax: the CancellationTokenSource is now disposed, and the file path uses Path.Join, which never drops the project path. The third finding, an unused label in CSharpLatestSyntax.cs, is a false positive: the label is used by C# 15's `continue outer;`, which the analyzer does not parse yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After a XAML generator error, the language-version hint now names only the projects that own the failing XAML files, not every project in the change set, as the compile-error path already does with its blocking projects. The UNOHR0002 doc entry now says a XAML error can come from the same cause, and the helper's comment no longer claims errors are filtered out by the tracker (they are just never carried, see FIXME). Spec 061 G2 is corrected: CI does run HRApp. The Windows Skia runtime-tests job sets UnoEnableHRuntimeTests and runs it through Given_HotReloadWorkspace.When_HotReloadScenario, which passed in build 245527. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-26318/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 245606 found UI Test snapshots differences: Details
|
Xiaoy312
left a comment
There was a problem hiding this comment.
LGTM. The net11 host now matches SDK 11.0.100's Roslyn/MSBuild, the dotnet-tools feed stays scoped to the projects restoring that line, and the version math (9 + (major − 5) against LatestMajor) lines up with the SDK. Since the tests are written relative to MaxCSharpVersion, the guard and the UNOHR0002 hint should keep catching the next time the host falls behind the SDK.
…-roslyn-512-7.0 fix(hr): Embed Roslyn 5.12 in the net11 dev-server (backport #26318)
GitHub Issue: closes #26316
PR Type:
🐞 Bugfix
What changed? 🚀
Before: SDK 11.0.100 defaults
net11.0projects to C# 15, but the net11 dev-server compiled Hot Reload changes with an embedded Roslyn 5.6 (up to C# 14). The MSBuild workspace silently drops the/langversion:15.0it cannot parse, so a single line of C# 15 in a project blocked every Hot Reload edit to it, XAML-only edits included, with compile errors the build does not have.After:
5.12.0-1.26529.118and MSBuild18.12.2, the exact builds SDK 11.0.100 ships (same VMR commit297acf930f). 5.12 is not on nuget.org yet, so it comes from the dncengdotnet-toolsfeed. The feed is added throughRestoreAdditionalProjectSourcesin the net11 block ofsrc/Uno.DevServer.Roslyn.props, notNuGet.Config, so only the four projects that restore this Roslyn line depend on it. Microsoft.Extensions pins are raised to 10.0.10, the floor 5.12 requires, for those projects only. The net9 and net10 flavors do not change.LangVersion). The hint is also sent as the warningUNOHR0002, so the IDE, the in-app indicator anduno_app_hot_reload_statusshow the reason, not only "Failed". This is for the next time the host falls behind the SDK.Given_CSharpLatestSyntax, hot reloads an edit inside that code.UNOHR0002is documented indoc/articles/uno-build-error-codes.md. Design, requirements and validation status:specs/061-hotreload-net11-roslyn-bump/spec.md.Validation (SDK 11.0.100, Windows)
Uno.HotReload.Tests: 176 passed, 0 failed, 1 skipped (Unix-only).Uno.UI.SourceGenerators.TestsMetadataUpdateTests: 244 passed, 0 failed, 7 skipped[Ignore]d), 97 metadata updates in one session. On 5.6 (same code, net11 line overridden) the XAML-onlyGiven_TextBlocktests andGiven_CSharpLatestSyntaxfail with the issue's errors (CS1002/CS0103/CS0201 oncontinue outer;), and the new warning and hint appearUno.HotReload, analyzers on, all target frameworks: 0 warnings, 0 errorsdotnet new unoapp -tfm net11.0, Uno.Sdk 7.0.5, pluscontinue outer;): the stock 7.0.32 dev-server blocks a XAML-only edit (CS1002), and this PR's dev-server from CI build 245527 applies it. Details in this commentUno.WinUI.DevServer:processors/net11.0carries Roslyn 5.12,processors/net10.0stays on 5.6.0, and the nuspec declares no Roslyn or MSBuild dependency, so customers don't need the feedNuGet.Configand an empty package cache, the four projects restore: 5.12 fromdotnet-tools, 5.6 from nuget.org (sources read from.nupkg.metadata)Microsoft.Build*.dllin the net11 Processors output (MSBuild still loads from the SDK). The 147 Roslyn binaries carry valid .NET/Microsoft Authenticode signaturesDecided
5.12.0-1.26529.118fromdotnet-tools, as decided here. The switch to the nuget.org5.12.0is tracked in Switch the net11 dev-server to the nuget.org Roslyn 5.12.0 and remove the dotnet-tools feed #26328.Given_CSharpLatestSyntaxincluded (Given_HotReloadWorkspace.When_HotReloadScenariopassed).Not yet run
Adding a package during a session, an MVVM Toolkit library, the net10 regression, SDK 11 previews.
The dev-server console gains one line after "Hot reload blocked by …" in the case above, and that operation's diagnostics gain one
UNOHR0002warning (also after a XAML generator error). Nothing in this repository parses the console output.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code