Skip to content

fix(hr): Embed Roslyn 5.12 in the net11 dev-server (backport #26318) - #26334

Merged
agneszitte merged 16 commits into
release/stable/7.0from
dev/agzi/backport-26318-hr-roslyn-512-7.0
Nov 12, 2026
Merged

agneszitte merged 16 commits into
release/stable/7.0from
dev/agzi/backport-26318-hr-roslyn-512-7.0

Conversation

@agneszitte

Copy link
Copy Markdown
Member

GitHub Issue: related to #26316

Backport of #26318 to release/stable/7.0, for 7.0 SR1.

PR Type:

🐞 Bugfix

What changed? 🚀

All 16 commits of #26318, cherry-picked with -x. They applied cleanly, with no changes. The full description, review and decisions are on #26318.

Before: on SDK 11.0.100, net11.0 projects default to C# 15, but the net11 dev-server compiled Hot Reload changes with Roslyn 5.6 (up to C# 14). One line of C# 15 blocked every Hot Reload edit to that project, XAML-only edits included.

After:

  • The net11 dev-server embeds Roslyn 5.12.0-1.26529.118 and MSBuild 18.12.2, the builds SDK 11.0.100 ships. The Roslyn build comes from the dotnet-tools feed, scoped to the four projects that restore it, until 5.12.0 reaches nuget.org (Switch the net11 dev-server to the nuget.org Roslyn 5.12.0 and remove the dotnet-tools feed #26328, to be backported here as well). The DevServer package declares no Roslyn dependency, so customers never need the feed.
  • When a project defaults to a newer C# version than the dev-server compiler, the dev-server warns at load, and each blocked reload is followed by a hint with the fix. The hint is also sent as the warning UNOHR0002, so the IDE and the app status show it. UNOHR0002 is documented in the error-codes page.
  • The net9 and net10 dev-server flavors don't change.

Validation on this branch (SDK 11.0.100, Windows)

Kind Result
Unit Uno.HotReload.Tests: 176 passed, 0 failed, 1 skipped (Unix-only)
Compile Release build of the Processors and Uno.HotReload, all target frameworks, warnings as errors: 0 warnings, 0 errors

The end-to-end repro of #26316 (blocked on the stock 7.0.32 dev-server, applied with the fix) was run against the CI package of #26318: see this comment.

PR Checklist ✅

🤖 Generated with Claude Code

DerekRaven and others added 16 commits November 12, 2026 00:00
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]>
(cherry picked from commit 25e5a6b)
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]>
(cherry picked from commit d912e08)
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]>
(cherry picked from commit bde97a9)
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]>
(cherry picked from commit b06f787)
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]>
(cherry picked from commit 9f9faae)
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]>
(cherry picked from commit 87403dc)
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]>
(cherry picked from commit 8ec8bac)
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]>
(cherry picked from commit 5bcf4c3)
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]>
(cherry picked from commit ac069f7)
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]>
(cherry picked from commit 1e62688)
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]>
(cherry picked from commit 25c312f)
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]>
(cherry picked from commit cb8163f)
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]>
(cherry picked from commit 0bd1e40)
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]>
(cherry picked from commit 2e3dc4b)
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]>
(cherry picked from commit 003fa00)
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]>
(cherry picked from commit e225e0d)
@agneszitte agneszitte added the area/hot-reload Categorizes an issue or PR as relevant to hot reload label Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 14s —— View job


Review of #26334 (backport of #26318 to 7.0)

Verdict: ship. I found no blocking issues, so I posted no inline comments (0 critical, 0 major, 0 minor).

I read the non-test source diff against origin/release/stable/7.0. I did not build or run anything, and I did not read the new unit tests or the spec in detail. The validation in the PR description is the author's own.

  • Code review (inspection only):
    • The C# version detection is guarded. ReportLanguageVersionHints and WarnOnUnsupportedLanguageVersions catch everything except OperationCanceledException, so a diagnostics failure cannot turn a blocked pass into an internal error.
    • ct2 is passed to WarnOnUnsupportedLanguageVersions and checked in its loop.
    • The code follows the repo style rules. Braces are always used, there is no event Action, and no Generated/ files are touched.
    • The UNOHR0002 descriptor sits inside the existing RS2008 pragma region.
  • Scoping: the net9 and net10 dev-server flavors are unchanged. The Roslyn 5.12 settings and the dotnet-tools feed are inside the net11.0 condition of Uno.DevServer.Roslyn.props. The feed is added through RestoreAdditionalProjectSources, so only projects that import that props file need it.
  • Tests: there is a unit test for the language-version logic and a runtime test, Given_CSharpLatestSyntax, that hot-reloads an edit inside C# 15 syntax. I saw no skipped or [Ignore]d tests in the diff.
  • Docs: UNOHR0002 is added to the error-codes page.

Points to confirm before merge

  • Feed dependency: the build depends on the dotnet-tools feed until 5.12.0 reaches nuget.org (Switch the net11 dev-server to the nuget.org Roslyn 5.12.0 and remove the dotnet-tools feed #26328). The PR notes that follow-up will be backported too. Please confirm CI restore on this branch passes with it.
  • Runtime-test scope: the HRApp <LangVersion></LangVersion> override, which makes the C# 15 syntax test compile on the default version, applies only to that test app. The test only exercises the fix when run with SDK 11, so the runtime-test job on net11 is the evidence to check.
  • Screenshots Compare: the Screenshots Compare Test Run checklist item is unchecked. It looks irrelevant here since no UI changes, but it should be ticked or marked N/A.

@mergify

mergify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 245618 did not find any UI Test snapshots differences.

@Xiaoy312 Xiaoy312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@agneszitte
agneszitte merged commit b2067bb into release/stable/7.0 Nov 12, 2026
56 checks passed
@agneszitte
agneszitte deleted the dev/agzi/backport-26318-hr-roslyn-512-7.0 branch November 12, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/hot-reload Categorizes an issue or PR as relevant to hot reload kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants