Skip to content

Enable runtime-async in CoreCLR System.Private.CoreLib#126594

Merged
agocke merged 5 commits intomainfrom
copilot/enable-runtime-async-corelib
Apr 8, 2026
Merged

Enable runtime-async in CoreCLR System.Private.CoreLib#126594
agocke merged 5 commits intomainfrom
copilot/enable-runtime-async-corelib

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

Description

Runtime-async was enabled for src/libraries (non-mobile/wasm) but was missing from the CoreCLR System.Private.CoreLib. This adds the runtime-async=on feature flag to src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj, matching the existing NativeAOT pattern with architecture and runtime flavor exclusions:

<PropertyGroup Condition="'$(TargetArchitecture)' != 'riscv64' and '$(TargetArchitecture)' != 'loongarch64' and '$(RuntimeFlavor)' != 'Mono'">
  <Features>$(Features);runtime-async=on</Features>
</PropertyGroup>

…scv64, loongarch64, and Mono

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/46f839bd-54df-446d-8b31-41b32d813c8c

Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables the Roslyn runtime-async=on feature flag when building CoreCLR’s System.Private.CoreLib, aligning CoreCLR CoreLib behavior with existing runtime-async enablement elsewhere while excluding known-unsupported architectures and Mono builds.

Changes:

  • Add runtime-async=on to Features for CoreCLR System.Private.CoreLib builds.
  • Gate the feature behind MSBuild conditions to exclude riscv64, loongarch64, and RuntimeFlavor=Mono.

Copy link
Copy Markdown
Member

@VSadov VSadov left a comment

Choose a reason for hiding this comment

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

LGTM. Hopefully no surprises when tests get to run.

@agocke agocke enabled auto-merge (squash) April 7, 2026 02:03
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
@github-actions

This comment has been minimized.

@hez2010
Copy link
Copy Markdown
Contributor

hez2010 commented Apr 7, 2026

Are we still in the window of preview3 so that this can be backported to it?

Copilot AI review requested due to automatic review settings April 7, 2026 16:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings April 8, 2026 05:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🤖 Copilot Code Review — PR #126594

Note

This review was generated by GitHub Copilot.

Holistic Assessment

Motivation: Justified. Runtime-async (runtime-async=on) is already enabled for libraries (src/libraries/Directory.Build.targets), NativeAOT System.Private.CoreLib, and test projects — CoreCLR's System.Private.CoreLib was the remaining gap. Closing that gap is the right thing to do.

Approach: The intent is correct but the latest commit (9865b9d, co-authored with @am11) introduced an unintended behavioral change. When the architecture-conditional PropertyGroup was deleted and the <Features> line was kept, it became part of the adjacent Configuration == Release PropertyGroup — restricting runtime-async=on to Release builds only. This is almost certainly unintentional.

Summary: ⚠️ Needs Changes. The core idea is sound, but the latest commit accidentally restricts runtime-async to Release configuration only, which is inconsistent with every other place the flag is set. Additionally, the NativeAOT SPCL still has the riscv64/loongarch64 exclusions that @am11 says are now resolved — creating an inconsistency between the two CoreLib projects.


Detailed Findings

❌ Configuration Restriction — runtime-async=on is now Release-only

The <Features>$(Features);runtime-async=on</Features> line now lives inside the Configuration == Release PropertyGroup (lines 86-89 of the current csproj):

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
  <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
  <Features>$(Features);runtime-async=on</Features>
</PropertyGroup>

This means Debug and Checked builds will NOT have runtime-async enabled for CoreCLR SPCL. This is inconsistent with:

Location Configuration restriction?
NativeAOT SPCL (src/coreclr/nativeaot/.../System.Private.CoreLib.csproj:48-49) None — all configurations
Libraries (src/libraries/Directory.Build.targets:140-145) None — all configurations
Tests (eng/testing/tests.targets:12-15) None — all configurations
CoreCLR SPCL (this PR) Release only

This appears to be an unintended side effect of applying @am11's suggestion to delete the architecture-conditional PropertyGroup. The deletion removed the </PropertyGroup> that closed the Release group and the <PropertyGroup Condition="..."> that opened the feature group — merging the <Features> line into the Release block.

Fix: Move <Features> into its own unconditional PropertyGroup, or add it to the existing unconditional PropertyGroup that follows:

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
  <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
</PropertyGroup>

<PropertyGroup>
  <Features>$(Features);runtime-async=on</Features>
</PropertyGroup>

⚠️ NativeAOT SPCL Inconsistency — still has riscv64/loongarch64 exclusions

If the riscv64 and loongarch64 runtime-async support is indeed complete (per @am11's review comment citing merged PRs #125446 and #125114), then the same exclusion removal should also be applied to the NativeAOT SPCL at src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj (lines 45-50), which still has:

<!-- Enable runtime async for Native AOT -->
<!-- RISC-V: https://github.com/dotnet/runtime/issues/124934 -->
<!-- LoongArch: https://github.com/dotnet/runtime/issues/124935 -->
<PropertyGroup Condition="'$(TargetArchitecture)' != 'riscv64' and '$(TargetArchitecture)' != 'loongarch64'">
  <Features>$(Features);runtime-async=on</Features>
</PropertyGroup>

Without updating NativeAOT SPCL, we end up with:

  • CoreCLR SPCL: runtime-async on all architectures
  • NativeAOT SPCL: runtime-async on all except riscv64/loongarch64

Note: tracking issues #124934 and #124935 are still open with unchecked items (including NativeAOT support). If the architecture work is not fully complete for NativeAOT, this inconsistency may be intentional — but it should be explicitly noted. Either way, the CoreCLR SPCL change should be made consistently with the NativeAOT SPCL.

⚠️ Stale Approval — VSadov's LGTM was on commit 1

@VSadov approved on the initial commit (c096559) which had Mono and architecture exclusions. The code has changed substantially since then (Mono exclusion removed per @MichalStrehovsky's feedback, architecture exclusions removed per @am11's feedback, and the unintended Release-only restriction). The current code is meaningfully different from what was approved.

💡 PR Description — Stale

The PR description still shows the original PropertyGroup with RuntimeFlavor != 'Mono' and architecture exclusions, and lists "riscv64 excluded" / "loongarch64 excluded" / "Mono flavor excluded" as features. None of these reflect the current state of the code. Consider updating.


Generated by Copilot Code Review workflow for PR #126594

Generated by Code Review for issue #126594 ·

@agocke
Copy link
Copy Markdown
Member

agocke commented Apr 8, 2026

/ba-g failures are networking

@agocke agocke disabled auto-merge April 8, 2026 16:48
@agocke agocke merged commit 714d206 into main Apr 8, 2026
111 of 115 checks passed
@agocke agocke deleted the copilot/enable-runtime-async-corelib branch April 8, 2026 16:49
@github-project-automation github-project-automation bot moved this to Done in AppModel Apr 8, 2026
@agocke
Copy link
Copy Markdown
Member

agocke commented Apr 9, 2026

/backport to release/11.0-preview3

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Started backporting to release/11.0-preview3 (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants