Skip to content

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

Open
Copilot wants to merge 3 commits intomainfrom
copilot/enable-runtime-async-corelib
Open

Enable runtime-async in CoreCLR System.Private.CoreLib#126594
Copilot wants to merge 3 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.

Comment on lines +90 to +94
<!-- 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>
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The PR description says runtime-async should be excluded for the Mono runtime flavor, but this PropertyGroup condition only excludes riscv64/loongarch64. This can enable runtime-async=on in unsupported Mono scenarios (the shared RuntimeAsyncSupported predicate elsewhere explicitly checks '$(RuntimeFlavor)' != 'Mono', e.g. src/libraries/Directory.Build.targets:131-136). Consider adding '$(RuntimeFlavor)' != 'Mono' to this condition (or otherwise reusing the repo’s existing RuntimeAsyncSupported predicate) so the behavior matches the PR description and existing platform support gating.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Note

This review was generated by Copilot.

🤖 Copilot Code Review — PR #126594

Holistic Assessment

Motivation: Enabling runtime-async for CoreCLR's System.Private.CoreLib is a natural next step — NativeAOT CoreLib already has this enabled with the identical pattern, and both libraries and tests already conditionally enable it. The feature is clearly progressing through the codebase incrementally, and this closes the gap for CoreCLR.

Approach: The approach is correct and minimal — a single PropertyGroup with a Condition excluding unsupported architectures (riscv64, loongarch64), matching the exact pattern already established in src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj. The second commit correctly removed the unnecessary RuntimeFlavor != 'Mono' check, since this .csproj is only ever built in the CoreCLR flavor (Mono has its own System.Private.CoreLib.csproj at src/mono/System.Private.CoreLib/).

Summary: ✅ LGTM. The change is a 6-line addition to a build file that enables runtime-async for CoreCLR's CoreLib, with appropriate architecture exclusions and issue references. It is consistent with existing patterns across the repo.


Detailed Findings

✅ Correctness — Condition matches established pattern

The new PropertyGroup condition:

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

is identical to what NativeAOT CoreLib uses (lines 48-50 of src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj). The architecture exclusions reference tracking issues (#124934, #124935). This is the correct pattern.

✅ Mono exclusion removal is safe

The second commit removed '$(RuntimeFlavor)' != 'Mono' from the condition. This is correct because:

  • This file (src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj) is only built under the CoreCLR runtime flavor
  • Mono has its own separate System.Private.CoreLib.csproj at src/mono/System.Private.CoreLib/
  • The NativeAOT CoreLib also does not check for RuntimeFlavor
  • The broader RuntimeAsyncSupported property in src/libraries/Directory.Build.targets and eng/testing/tests.targets already handles the Mono exclusion for libraries/tests

✅ Consistency with codebase

The change aligns with how runtime-async is already enabled elsewhere:

  • src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj — same pattern
  • src/libraries/Directory.Build.targets — enables for library source projects with broader platform checks
  • eng/testing/tests.targets — enables for test projects

💡 Minor — Missing descriptive comment

The NativeAOT CoreLib has a comment <!-- Enable runtime async for Native AOT --> above the issue references, but the CoreCLR version no longer has such a comment (it was present in the first commit but removed in the second). This is cosmetic and not blocking — the issue links and the Features property name make the intent clear.

Generated by Code Review for issue #126594 ·

Comment on lines 88 to +92
</PropertyGroup>

<!-- RISC-V: https://github.com/dotnet/runtime/issues/124934 -->
<!-- LoongArch: https://github.com/dotnet/runtime/issues/124935 -->
<PropertyGroup Condition="'$(TargetArchitecture)' != 'riscv64' and '$(TargetArchitecture)' != 'loongarch64'">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both of them were fixed: #125446 and #125114.

Suggested change
</PropertyGroup>
<!-- RISC-V: https://github.com/dotnet/runtime/issues/124934 -->
<!-- LoongArch: https://github.com/dotnet/runtime/issues/124935 -->
<PropertyGroup Condition="'$(TargetArchitecture)' != 'riscv64' and '$(TargetArchitecture)' != 'loongarch64'">

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

Projects

Status: No status
Status: No status

Development

Successfully merging this pull request may close these issues.

8 participants