Enable RuntimeAsync as .NET 11 preview feature#6488
Enable RuntimeAsync as .NET 11 preview feature#6488manandre wants to merge 3 commits intonpgsql:mainfrom
Conversation
There was a problem hiding this comment.
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=onfornet11.0builds. - 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", |
There was a problem hiding this comment.
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.
| "rollForward": "latestMajor", | |
| "rollForward": "latestFeature", |
| env: | ||
| dotnet_sdk_version: '11.0.100-preview.2.26159.112' | ||
| postgis_version: 3 |
There was a problem hiding this comment.
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.
| os: [ubuntu-24.04] | ||
| pg_major: [18, 17, 16, 15, 14] | ||
| config: [Release] | ||
| test_tfm: [net10.0] | ||
| test_tfm: [net11.0] | ||
| include: |
There was a problem hiding this comment.
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.
|
@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. |
|
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. |
Yes, it is now officially documented in dotnet/runtime#109632
|
|
Going to convert this to a draft until the next preview is released. |
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.