Skip to content

chore: Migrate tests to use .NET 11 - #3333

Open
filzrev wants to merge 5 commits into
dotnet:masterfrom
filzrev:chore-migrate-tests-to-net11
Open

filzrev wants to merge 5 commits into
dotnet:masterfrom
filzrev:chore-migrate-tests-to-net11

Conversation

@filzrev

@filzrev filzrev commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

This PR update CI tests to use .NET 11.
The purpose of changes are to test .NET 11 specific JIT behaviors and features(e.g. CoreWasm)

.NET 10 tests are intentionally omitted because running both .NET 10/11 tests takes long time and required additional workload (wasm-tools-net10).

Other changes

1. Add TestDefaults.cs

Add file that define common test settings.

2. Modify ParameterInstanceTests.cs

Add #ifdef NET to avoid vstest related issue.

3. Modify RuntimeMoniker.cs

Enable CoreWasm and related tests. (It's still experimental on .NET 11 though)

4. Update build/common.props

Update LangVersion from 14 to 15

- Pin the .NET 11.0.100 SDK in build/sdk/global.json and drop the .NET 8 SDK install workarounds from build/build.ps1 and build/build.sh

- Add a temporary DOTNET_INSTALL_SKIP_TAR workaround for dotnet/install-scripts#750 while installing the .NET 11 SDK

- Set LangVersion to 15.0 and retarget the Cake build project to net11.0 (Cake.Frosting 6.3.0, System.Security.Cryptography.Pkcs 11.0.0)

- Run 'in-tests-core' against the first configured test target framework instead of hardcoding net10.0

- Install/select the .NET 11 SDK in CI workflows (setup-additional-tools, run-tests, run-tests-selected, generate-coverage-report) and update actions.lock
Core WebAssembly with net11.0 is no longer experimental, so expose RuntimeMoniker.CoreWasm11_0 ("corewasm11.0") as a public constant.
Retarget the test projects to net11.0 and keep net472 (net462/net48) on Windows only.

Add TestDefaults to centralize the default Core/R2R/NativeAOT/WASM toolchains and runtimes (net11.0) and migrate call sites and test expectations accordingly.

Enable the CoreWasm test rows in WasmTests; skip the NativeAOT memory diagnoser test on Windows Arm64 (issue dotnet#3329) instead of macOS; work around the vstest emoji-width issue in ParameterInstanceTests (issue #16512).
// Still experimental
//public const string CoreWasm11_0 = "corewasm11.0";
/// <summary>Core WebAssembly with net11.0</summary>
public const string CoreWasm11_0 = "corewasm11.0";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Afaik it's still WIP until .Net 12, so we shouldn't expose this yet. Users who need it can specify the string directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've changed this constant visibility to internal.
It's expected to be used only for tests and will be removed when WASM on CoreCLR is available on .NET 12.

<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks</AssemblyTitle>
<TargetFrameworks>net462;net48;net8.0;net10.0</TargetFrameworks>
<TargetFrameworks>net11.0;net10.0;net8.0</TargetFrameworks>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't need to test 3 core runtimes. Can just do 10 and 11.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ManualRunning.MultipleFrameworks is expected to be used to tests lagacy tfms compatibility also.
So I've leaved net8.0 on this project.
(When migrated to xUnit.v3. this project using TUnit to test net462)

Assert.True(runtime is ClrRuntime, $"Actual runtime: {runtime}");
else
Assert.True(runtime is MonoRuntime, $"Actual runtime: {runtime}");
#elif NET11_0_OR_GREATER

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like the net10 and 8 branches are dead code.

Comment thread BenchmarkDotNet.slnx
<Project Path="tests/BenchmarkDotNet.IntegrationTests.ManualRunning/BenchmarkDotNet.IntegrationTests.ManualRunning.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.MonoBenchmarks/BenchmarkDotNet.IntegrationTests.MonoBenchmarks.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.WasmBenchmarks/BenchmarkDotNet.IntegrationTests.WasmBenchmarks.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.RuntimeAsync/BenchmarkDotNet.IntegrationTests.RuntimeAsync.csproj" />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you also add this project to the CI test runs?

This branch has not been deployed

No deployments
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.

2 participants