Skip to content

Enable RuntimeAsync as .NET 11 preview feature#6488

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

Enable RuntimeAsync as .NET 11 preview feature#6488
manandre wants to merge 13 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.

Comment thread global.json Outdated
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml
@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
@manandre
Copy link
Copy Markdown
Collaborator Author

I have moved to .NET 11 Preview 3 (released yesterday) which now supports NativeAOT, but the same NativeAOT issue is still present :/
I have found a workaround (see 8236a51) but such a change should not be required.
I have created a standalone repo with a minimal reproduction scenario.
See manandre/repro-dotnet-runtime-async-aot-json
Should we open an issue on dotnet/runtime about this?

@NinoFloris
Copy link
Copy Markdown
Member

NinoFloris commented Apr 15, 2026

Yes I think they would absolutely welcome it sooner rather than later. I did a very quick search on dotnet/runtime and can't find any issues related to this either. Thanks for making the repro.

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