Skip to content

Conversation

@filzrev
Copy link
Contributor

@filzrev filzrev commented Nov 25, 2025

This PR update LangVersion from 12 to 14.

After this PR is merged.
BenchmarkDotNet source build requires .NET 10 SDK.

Other changes

1. build/sdk/global.json

Update SDK version to 10.0.100 to use LangVersion 14.
This setting seems also applied to unit tests. (By existing roll forward setting)
So by this change. tests app that build target net80 are executed under .NET 10 runtime.

2. src/BenchmarkDotNet/Code/DeclarationsProvider.cs

Rename field variable name to fieldInfo to fix build error that occurred when using field property name on C# 14.

3. build\BenchmarkDotNet.Build\Program.cs

Add steps to install wasm-tools-net8 workload.
When build .NET 8 WASM project with .NET SDK 10.
It need to install additional workload.
https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-build-tools-and-aot?view=aspnetcore-10.0#net-webassembly-build-tools

4. tests/BenchmarkDotNet.IntegrationTests/NugetReferenceTests.cs

When build project with .NET 10 SDK.
System.Collection.Immutable package is pruned and resolved to SDK version assembly.
So I've added code for custom comparison.

5.
tests/BenchmarkDotNet.IntegrationTests/MultipleRuntimesTest.cs
tests/BenchmarkDotNet.IntegrationTests/LargeAddressAwareTest.cs
tests/BenchmarkDotNet.Tests/RuntimeVersionDetectionTests.cs
tests/BenchmarkDotNet.Tests/Helpers/DotNetRuntimeHelper.cs

Modify assertion logics to support environment that using DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2.

@filzrev filzrev force-pushed the chore-update-languageversion-14 branch from eb27045 to ed1f11c Compare November 25, 2025 01:52
@filzrev
Copy link
Contributor Author

filzrev commented Nov 25, 2025

Following tests failed on CI environment (It's passed on local environment)

Failed CurrentRuntimeIsProperlyRecognized [1 ms]
Error Message:
 Actual runtime: .NET 10.0, tfm: net10.0, moniker: Net10_0
Stack Trace:
  at BenchmarkDotNet.Tests.RuntimeVersionDetectionTests.CurrentRuntimeIsProperlyRecognized() in /home/runner/work/BenchmarkDotNet/BenchmarkDotNet/tests/BenchmarkDotNet.Tests/RuntimeVersionDetectionTests.cs:line 123
  at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
  at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Not only for build stage.
.NET 8 targeted tests are also executed on .NET 10 runtime

It seems DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2 settings affecting this behavior differences.

@filzrev filzrev force-pushed the chore-update-languageversion-14 branch from f97c6ed to c221f2b Compare November 25, 2025 09:20
@filzrev filzrev force-pushed the chore-update-languageversion-14 branch from c221f2b to e196fec Compare November 25, 2025 10:09
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.

1 participant