Skip to content

Enable RuntimeAsync as .NET 11 preview feature#6488

Draft
manandre wants to merge 3 commits intonpgsql:mainfrom
manandre:runtime-async
Draft

Enable RuntimeAsync as .NET 11 preview feature#6488
manandre wants to merge 3 commits intonpgsql:mainfrom
manandre:runtime-async

Conversation

@manandre
Copy link
Copy Markdown
Collaborator

See dotnet/runtime#109632

The target is to detect potential issues as soon as possible and not wait for .NET release candidates, when it is generally difficult to get fixes in time.

@manandre manandre requested review from roji and vonzshik as code owners March 11, 2026 23:11
Copilot AI review requested due to automatic review settings March 11, 2026 23:11
Copy link
Copy Markdown

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 updates the repo to build and test against the .NET 11 preview SDK and enables the runtime-async preview feature when targeting net11.0, to surface runtime-async related issues earlier in the release cycle.

Changes:

  • Multi-target core library, plugins, and tests for net10.0;net11.0.
  • Opt in to .NET 11 preview features and enable runtime-async=on for net11.0 builds.
  • Update CI/dev tooling to use a .NET 11 preview SDK and run most CI test legs on net11.0.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/Directory.Build.props Multi-target tests for net10.0 and net11.0.
src/Npgsql/Npgsql.csproj Multi-target Npgsql for net10.0;net11.0.
src/Npgsql.OpenTelemetry/Npgsql.OpenTelemetry.csproj Multi-target OpenTelemetry plugin for net10.0;net11.0.
src/Npgsql.NodaTime/Npgsql.NodaTime.csproj Multi-target NodaTime plugin for net10.0;net11.0.
src/Npgsql.NetTopologySuite/Npgsql.NetTopologySuite.csproj Multi-target NTS plugin for net10.0;net11.0.
src/Npgsql.Json.NET/Npgsql.Json.NET.csproj Multi-target Json.NET plugin for net10.0;net11.0.
src/Npgsql.GeoJSON/Npgsql.GeoJSON.csproj Multi-target GeoJSON plugin for net10.0;net11.0.
src/Npgsql.DependencyInjection/Npgsql.DependencyInjection.csproj Multi-target DI plugin for net10.0;net11.0.
global.json Move repo SDK to .NET 11 preview and allow prerelease SDK usage.
Directory.Packages.props Expand version property condition to include net11.0.
Directory.Build.props Enable preview features and runtime-async=on for net11.0.
.github/workflows/native-aot.yml Pin/setup .NET 11 preview SDK and run NativeAOT checks on net11.0.
.github/workflows/build.yml Pin/setup .NET 11 preview SDK and run most test matrix legs on net11.0.
.devcontainer/devcontainer.json Update devcontainer to use .NET 11 preview SDK and adjust runtime installs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"sdk": {
"version": "10.0.200",
"version": "11.0.100-preview.2",
"rollForward": "latestMajor",
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

With rollForward: "latestMajor" and allowPrerelease: true, local/dev builds can silently roll to a different major preview SDK (e.g., 12.x previews) if 11.x isn't installed, making issues hard to reproduce. Consider pinning roll-forward within the 11.x band (e.g., latestFeature/latestPatch) or specifying the full SDK build you expect developers/CI to use.

Suggested change
"rollForward": "latestMajor",
"rollForward": "latestFeature",

Copilot uses AI. Check for mistakes.
Comment on lines 20 to 22
env:
dotnet_sdk_version: '11.0.100-preview.2.26159.112'
postgis_version: 3
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The .NET SDK version is now duplicated across global.json, multiple GitHub workflows, and the devcontainer config, which makes it easy for them to drift (CI and local/devcontainer could be on different preview builds). Consider sourcing CI from global.json (e.g., using global-json-file) or otherwise centralizing the SDK version so it only needs updating in one place.

Copilot uses AI. Check for mistakes.
Comment on lines 35 to 39
os: [ubuntu-24.04]
pg_major: [18, 17, 16, 15, 14]
config: [Release]
test_tfm: [net10.0]
test_tfm: [net11.0]
include:
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

Because the repo now multi-targets net10.0;net11.0, the workflow's dotnet build step (which doesn't specify -f) will build both TFMs for every PostgreSQL/OS entry in the matrix. If the intent is primarily to exercise net11 runtime-async behavior, consider building/testing only matrix.test_tfm in the main matrix and keeping a separate minimal job for net10 to control CI time.

Copilot uses AI. Check for mistakes.
@roji
Copy link
Copy Markdown
Member

roji commented Mar 12, 2026

@manandre thanks, it's a good idea; but is it a bit premature to do this, given that even the runtime libraries themselves (and their tests) aren't being built with runtime-async?

Also, I'm unclear on whether targeting the net11.0 TFM is necessary here - do you have any resources/info you can point to on this? We may end up multi-targeting in any case if we need some new API introduced in net11.0; it would just be better to not do this unless there's such a case.

In any case, we can of course use the latest dotnet preview SDK - that's always a good idea.

@NinoFloris
Copy link
Copy Markdown
Member

Seems like we're already running into a NativeAOT compiler bug in this area. I've locally also run into debugger issues on the runtime shipped with SDK 10.0.200 (10.0.4) which seems to have already opted into some runtime async.

@manandre
Copy link
Copy Markdown
Collaborator Author

Also, I'm unclear on whether targeting the net11.0 TFM is necessary here - do you have any resources/info you can point to on this?

Yes, it is now officially documented in dotnet/runtime#109632

The project must target net11.0

@NinoFloris
Copy link
Copy Markdown
Member

Going to convert this to a draft until the next preview is released.

@NinoFloris NinoFloris marked this pull request as draft March 17, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants