Skip to content

Enable runtime-async for shared framework source projects in net11.0+…#126343

Merged
agocke merged 1 commit intodotnet:release/11.0-preview3from
agocke:backport/125406-to-11.0-preview3
Apr 1, 2026
Merged

Enable runtime-async for shared framework source projects in net11.0+…#126343
agocke merged 1 commit intodotnet:release/11.0-preview3from
agocke:backport/125406-to-11.0-preview3

Conversation

@agocke
Copy link
Copy Markdown
Member

@agocke agocke commented Mar 31, 2026

… and remove RuntimeAsync config knob (#125406)

Description

Auto-enables runtime-async for shared framework (IsNETCoreAppSrc) source projects targeting net11.0+, with exclusions for platforms where it's not yet working and for assemblies that ship as OOB NuGet packages. Also fully removes the UNSUPPORTED_RuntimeAsync / DOTNET_RuntimeAsync config knob and the runtimeAsync field/accessor from the runtime, since runtime-async is now unconditionally enabled. Additionally fixes PEObjectWriter relocation handling for RISC-V and LoongArch to properly support non-zero addends.

Conditions for enablement:

  • IsNETCoreAppSrc — scoped to shared framework only
  • IsPackable != true — excludes OOB NuGet packages (e.g., System.Text.Json, System.Collections.Immutable) to avoid Mono compatibility issues when those packages are referenced in non-CoreCLR environments
  • IsTargetFrameworkCompatible(TFM, 'net11.0') — no pre-net11 TFMs
  • RuntimeAsyncSupported shared property — consolidates platform exclusions (browser, wasi, android, Apple mobile, Mono) into a single predicate used by both library source and test builds
  • Per-project opt-out via UseRuntimeAsync=false

Changes:

  • src/libraries/Directory.Build.targets — Defines RuntimeAsyncSupported shared property with platform exclusions. Auto-enables runtime-async for IsNETCoreAppSrc source projects on net11.0+ supported platforms, excluding OOB packages (IsPackable=true). Replaces the previous explicit UseRuntimeAsync=true opt-in gate.
  • eng/testing/tests.targets — Defines matching RuntimeAsyncSupported property (guarded against redefinition). Removes the TestReadyToRun special-case condition since libraries now ship with runtime-async. Simplifies test enablement to use the shared RuntimeAsyncSupported property.
  • src/coreclr/inc/clrconfigvalues.h — Removes the UNSUPPORTED_RuntimeAsync config definition (which mapped to DOTNET_RuntimeAsync env var).
  • src/coreclr/vm/eeconfig.h — Removes the runtimeAsync field and the RuntimeAsync() accessor method entirely, since the feature is now unconditionally enabled.
  • src/coreclr/vm/eeconfig.cpp — Removes config value read and the runtimeAsync field initialization.
  • src/coreclr/vm/method.cpp — Removes the dead g_pConfig->RuntimeAsync() early-return guard in
    ClassifyMethodReturnKind, since runtime-async is always on.
  • src/tests/Interop/COM/RuntimeAsync/RuntimeAsync.csproj — Removes DOTNET_RuntimeAsync env variable and the RequiresProcessIsolation property that was only needed for it.
  • EnablePreviewFeatures removed — Removed EnablePreviewFeatures=true from both eng/testing/tests.targets and src/libraries/Directory.Build.targets since runtime-async is no longer a preview feature.
  • src/coreclr/tools/Common/Compiler/ObjectWriter/PEObjectWriter.cs — Fixes RISC-V and LoongArch relocation handling in ResolveRelocations: removes the if (addend != 0) { throw new NotSupportedException(); } guards and replaces symbolImageOffset with long targetAddress = symbolImageOffset + addend to properly incorporate addends, consistent with all other relocation types in the method.

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.


… and remove RuntimeAsync config knob (dotnet#125406)

## Description

Auto-enables `runtime-async` for shared framework (`IsNETCoreAppSrc`)
source projects targeting net11.0+, with exclusions for platforms where
it's not yet working and for assemblies that ship as OOB NuGet packages.
Also fully removes the `UNSUPPORTED_RuntimeAsync` /
`DOTNET_RuntimeAsync` config knob and the `runtimeAsync` field/accessor
from the runtime, since runtime-async is now unconditionally enabled.
Additionally fixes PEObjectWriter relocation handling for RISC-V and
LoongArch to properly support non-zero addends.

**Conditions for enablement:**
- `IsNETCoreAppSrc` — scoped to shared framework only
- `IsPackable != true` — excludes OOB NuGet packages (e.g.,
System.Text.Json, System.Collections.Immutable) to avoid Mono
compatibility issues when those packages are referenced in non-CoreCLR
environments
- `IsTargetFrameworkCompatible(TFM, 'net11.0')` — no pre-net11 TFMs
- `RuntimeAsyncSupported` shared property — consolidates platform
exclusions (browser, wasi, android, Apple mobile, Mono) into a single
predicate used by both library source and test builds
- Per-project opt-out via `UseRuntimeAsync=false`

**Changes:**

- **`src/libraries/Directory.Build.targets`** — Defines
`RuntimeAsyncSupported` shared property with platform exclusions.
Auto-enables runtime-async for `IsNETCoreAppSrc` source projects on
net11.0+ supported platforms, excluding OOB packages
(`IsPackable=true`). Replaces the previous explicit
`UseRuntimeAsync=true` opt-in gate.
- **`eng/testing/tests.targets`** — Defines matching
`RuntimeAsyncSupported` property (guarded against redefinition). Removes
the `TestReadyToRun` special-case condition since libraries now ship
with runtime-async. Simplifies test enablement to use the shared
`RuntimeAsyncSupported` property.
- **`src/coreclr/inc/clrconfigvalues.h`** — Removes the
`UNSUPPORTED_RuntimeAsync` config definition (which mapped to
`DOTNET_RuntimeAsync` env var).
- **`src/coreclr/vm/eeconfig.h`** — Removes the `runtimeAsync` field and
the `RuntimeAsync()` accessor method entirely, since the feature is now
unconditionally enabled.
- **`src/coreclr/vm/eeconfig.cpp`** — Removes config value read and the
`runtimeAsync` field initialization.
- **`src/coreclr/vm/method.cpp`** — Removes the dead
`g_pConfig->RuntimeAsync()` early-return guard in
`ClassifyMethodReturnKind`, since runtime-async is always on.
- **`src/tests/Interop/COM/RuntimeAsync/RuntimeAsync.csproj`** — Removes
`DOTNET_RuntimeAsync` env variable and the `RequiresProcessIsolation`
property that was only needed for it.
- **`EnablePreviewFeatures` removed** — Removed
`EnablePreviewFeatures=true` from both `eng/testing/tests.targets` and
`src/libraries/Directory.Build.targets` since runtime-async is no longer
a preview feature.
- **`src/coreclr/tools/Common/Compiler/ObjectWriter/PEObjectWriter.cs`**
— Fixes RISC-V and LoongArch relocation handling in
`ResolveRelocations`: removes the `if (addend != 0) { throw new
NotSupportedException(); }` guards and replaces `symbolImageOffset` with
`long targetAddress = symbolImageOffset + addend` to properly
incorporate addends, consistent with all other relocation types in the
method.

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: Andy Gocke <angocke@microsoft.com>
Co-authored-by: Andy Gocke <andy@commentout.net>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
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

This PR makes runtime-async the default for shared framework source projects targeting net11.0+ (on supported platforms), removes the now-unneeded runtime config knob and runtime-side plumbing, and extends PE relocation resolution to correctly handle non-zero addends for RISC-V and LoongArch.

Changes:

  • Auto-enable runtime-async=on for IsNETCoreAppSrc projects on net11.0+ (excluding unsupported platforms and IsPackable=true OOB packages), and align test builds with the same platform predicate.
  • Remove the UNSUPPORTED_RuntimeAsync / DOTNET_RuntimeAsync config surface and the CoreCLR EEConfig field/accessor/guard that depended on it.
  • Fix relocation resolution for RISC-V/LoongArch to incorporate addends rather than rejecting them.

Reviewed changes

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

Show a summary per file
File Description
src/libraries/Directory.Build.targets Introduces RuntimeAsyncSupported predicate and auto-enables runtime-async for eligible shared framework source projects.
eng/testing/tests.targets Applies runtime-async to net11.0+ test projects based on RuntimeAsyncSupported and removes preview/knob gating.
src/coreclr/inc/clrconfigvalues.h Removes the UNSUPPORTED_RuntimeAsync config definition.
src/coreclr/vm/eeconfig.h Removes the runtimeAsync config field and accessor.
src/coreclr/vm/eeconfig.cpp Removes initialization and config-reading for runtimeAsync.
src/coreclr/vm/method.cpp Removes the now-dead RuntimeAsync() guard in ClassifyMethodReturnKind.
src/tests/Interop/COM/RuntimeAsync/RuntimeAsync.csproj Drops process-isolation and env-var plumbing for DOTNET_RuntimeAsync.
src/coreclr/tools/Common/Compiler/ObjectWriter/PEObjectWriter.cs Updates LoongArch/RISC-V relocation resolution to include addends.
src/coreclr/tools/Common/Compiler/DependencyAnalysis/Relocation.cs Adjusts RISC-V relocation patching assertions (but see review comment).

@agocke
Copy link
Copy Markdown
Member Author

agocke commented Mar 31, 2026

/ba-g failures are timeouts

@agocke agocke added the Servicing-approved Approved for servicing release label Mar 31, 2026
@agocke agocke merged commit e7c4426 into dotnet:release/11.0-preview3 Apr 1, 2026
168 of 172 checks passed
@agocke agocke deleted the backport/125406-to-11.0-preview3 branch April 1, 2026 22:36
@github-project-automation github-project-automation bot moved this to Done in AppModel Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr Servicing-approved Approved for servicing release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants