Skip to content

Commit c823415

Browse files
authored
Add net11 support (dotnet#2911)
* Add net11.0 support. * Some additional net11.0 updates. * Don't update BenchmarkDotNetBuild.csproj tfm. * Revert changes to RuntimeVersionDetectionTests.cs. * Revert change to DotNetRuntimeHelper. * Fix missing comma. * Undo update of NativeAot/Generator.cs as sse4.2 is only needed to return on net10.0 and earlier.
1 parent 86a0869 commit c823415

File tree

22 files changed

+113
-6
lines changed

22 files changed

+113
-6
lines changed

NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
1515
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
1616
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
17+
<add key="dotnet11" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11/nuget/v3/index.json" />
1718

1819
<!-- required for Roslyn analyzers -->
1920
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />

src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public enum RuntimeMoniker
109109
/// </summary>
110110
Net10_0,
111111

112+
/// <summary>
113+
/// .NET 11.0
114+
/// </summary>
115+
Net11_0,
116+
112117
/// <summary>
113118
/// NativeAOT compiled as net6.0
114119
/// </summary>
@@ -134,6 +139,11 @@ public enum RuntimeMoniker
134139
/// </summary>
135140
NativeAot10_0,
136141

142+
/// <summary>
143+
/// NativeAOT compiled as net11.0
144+
/// </summary>
145+
NativeAot11_0,
146+
137147
/// <summary>
138148
/// WebAssembly with default .Net version
139149
/// </summary>
@@ -169,6 +179,11 @@ public enum RuntimeMoniker
169179
/// </summary>
170180
WasmNet10_0,
171181

182+
/// <summary>
183+
/// WebAssembly with net11.0
184+
/// </summary>
185+
WasmNet11_0,
186+
172187
/// <summary>
173188
/// Mono with the Ahead of Time LLVM Compiler backend
174189
/// </summary>
@@ -199,6 +214,11 @@ public enum RuntimeMoniker
199214
/// </summary>
200215
MonoAOTLLVMNet10_0,
201216

217+
/// <summary>
218+
/// Mono with the Ahead of Time LLVM Compiler backend and net11.0
219+
/// </summary>
220+
MonoAOTLLVMNet11_0,
221+
202222
/// <summary>
203223
/// .NET 6 using MonoVM (not CLR which is the default)
204224
/// </summary>
@@ -223,5 +243,10 @@ public enum RuntimeMoniker
223243
/// .NET 10 using MonoVM (not CLR which is the default)
224244
/// </summary>
225245
Mono10_0,
246+
247+
/// <summary>
248+
/// .NET 11 using MonoVM (not CLR which is the default)
249+
/// </summary>
250+
Mono11_0,
226251
}
227252
}

src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
8282
case RuntimeMoniker.Net80:
8383
case RuntimeMoniker.Net90:
8484
case RuntimeMoniker.Net10_0:
85+
case RuntimeMoniker.Net11_0:
8586
return true;
8687
case RuntimeMoniker.NotRecognized:
8788
case RuntimeMoniker.Mono:
@@ -90,24 +91,28 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
9091
case RuntimeMoniker.NativeAot80:
9192
case RuntimeMoniker.NativeAot90:
9293
case RuntimeMoniker.NativeAot10_0:
94+
case RuntimeMoniker.NativeAot11_0:
9395
case RuntimeMoniker.Wasm:
9496
case RuntimeMoniker.WasmNet50:
9597
case RuntimeMoniker.WasmNet60:
9698
case RuntimeMoniker.WasmNet70:
9799
case RuntimeMoniker.WasmNet80:
98100
case RuntimeMoniker.WasmNet90:
99101
case RuntimeMoniker.WasmNet10_0:
102+
case RuntimeMoniker.WasmNet11_0:
100103
case RuntimeMoniker.MonoAOTLLVM:
101104
case RuntimeMoniker.MonoAOTLLVMNet60:
102105
case RuntimeMoniker.MonoAOTLLVMNet70:
103106
case RuntimeMoniker.MonoAOTLLVMNet80:
104107
case RuntimeMoniker.MonoAOTLLVMNet90:
105108
case RuntimeMoniker.MonoAOTLLVMNet10_0:
109+
case RuntimeMoniker.MonoAOTLLVMNet11_0:
106110
case RuntimeMoniker.Mono60:
107111
case RuntimeMoniker.Mono70:
108112
case RuntimeMoniker.Mono80:
109113
case RuntimeMoniker.Mono90:
110114
case RuntimeMoniker.Mono10_0:
115+
case RuntimeMoniker.Mono11_0:
111116
return false;
112117
case RuntimeMoniker.NetCoreApp20:
113118
case RuntimeMoniker.NetCoreApp21:

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
8585
case RuntimeMoniker.Net80:
8686
case RuntimeMoniker.Net90:
8787
case RuntimeMoniker.Net10_0:
88+
case RuntimeMoniker.Net11_0:
8889
return true;
8990
case RuntimeMoniker.NotRecognized:
9091
case RuntimeMoniker.Mono:
@@ -93,24 +94,28 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
9394
case RuntimeMoniker.NativeAot80:
9495
case RuntimeMoniker.NativeAot90:
9596
case RuntimeMoniker.NativeAot10_0:
97+
case RuntimeMoniker.NativeAot11_0:
9698
case RuntimeMoniker.Wasm:
9799
case RuntimeMoniker.WasmNet50:
98100
case RuntimeMoniker.WasmNet60:
99101
case RuntimeMoniker.WasmNet70:
100102
case RuntimeMoniker.WasmNet80:
101103
case RuntimeMoniker.WasmNet90:
102104
case RuntimeMoniker.WasmNet10_0:
105+
case RuntimeMoniker.WasmNet11_0:
103106
case RuntimeMoniker.MonoAOTLLVM:
104107
case RuntimeMoniker.MonoAOTLLVMNet60:
105108
case RuntimeMoniker.MonoAOTLLVMNet70:
106109
case RuntimeMoniker.MonoAOTLLVMNet80:
107110
case RuntimeMoniker.MonoAOTLLVMNet90:
108111
case RuntimeMoniker.MonoAOTLLVMNet10_0:
112+
case RuntimeMoniker.MonoAOTLLVMNet11_0:
109113
case RuntimeMoniker.Mono60:
110114
case RuntimeMoniker.Mono70:
111115
case RuntimeMoniker.Mono80:
112116
case RuntimeMoniker.Mono90:
113117
case RuntimeMoniker.Mono10_0:
118+
case RuntimeMoniker.Mono11_0:
114119
return false;
115120
case RuntimeMoniker.NetCoreApp20:
116121
case RuntimeMoniker.NetCoreApp21:

src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
538538
case RuntimeMoniker.Net80:
539539
case RuntimeMoniker.Net90:
540540
case RuntimeMoniker.Net10_0:
541+
case RuntimeMoniker.Net11_0:
541542
{
542543
var runtime = runtimeMoniker.GetRuntime();
543544
return baseJob
@@ -567,6 +568,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
567568
case RuntimeMoniker.NativeAot10_0:
568569
return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json");
569570

571+
case RuntimeMoniker.NativeAot11_0:
572+
return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11/nuget/v3/index.json");
573+
570574
case RuntimeMoniker.Wasm:
571575
return MakeWasmJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net5.0", runtimeMoniker);
572576

@@ -588,6 +592,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
588592
case RuntimeMoniker.WasmNet10_0:
589593
return MakeWasmJob(baseJob, options, "net10.0", runtimeMoniker);
590594

595+
case RuntimeMoniker.WasmNet11_0:
596+
return MakeWasmJob(baseJob, options, "net11.0", runtimeMoniker);
597+
591598
case RuntimeMoniker.MonoAOTLLVM:
592599
return MakeMonoAOTLLVMJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net6.0", runtimeMoniker);
593600

@@ -606,6 +613,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
606613
case RuntimeMoniker.MonoAOTLLVMNet10_0:
607614
return MakeMonoAOTLLVMJob(baseJob, options, "net10.0", runtimeMoniker);
608615

616+
case RuntimeMoniker.MonoAOTLLVMNet11_0:
617+
return MakeMonoAOTLLVMJob(baseJob, options, "net11.0", runtimeMoniker);
618+
609619
case RuntimeMoniker.Mono60:
610620
return MakeMonoJob(baseJob, options, MonoRuntime.Mono60);
611621

@@ -621,6 +631,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
621631
case RuntimeMoniker.Mono10_0:
622632
return MakeMonoJob(baseJob, options, MonoRuntime.Mono10_0);
623633

634+
case RuntimeMoniker.Mono11_0:
635+
return MakeMonoJob(baseJob, options, MonoRuntime.Mono11_0);
636+
624637
default:
625638
throw new NotSupportedException($"Runtime {runtimeId} is not supported");
626639
}

src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public class CoreRuntime : Runtime
2525
public static readonly CoreRuntime Core80 = new(RuntimeMoniker.Net80, "net8.0", ".NET 8.0");
2626
public static readonly CoreRuntime Core90 = new(RuntimeMoniker.Net90, "net9.0", ".NET 9.0");
2727
public static readonly CoreRuntime Core10_0 = new(RuntimeMoniker.Net10_0, "net10.0", ".NET 10.0");
28+
public static readonly CoreRuntime Core11_0 = new(RuntimeMoniker.Net11_0, "net11.0", ".NET 11.0");
2829

29-
public static CoreRuntime Latest => Core10_0; // when dotnet/runtime branches for 11.0, this will need to get updated
30+
public static CoreRuntime Latest => Core11_0; // when dotnet/runtime branches for 12.0, this will need to get updated
3031

3132
private CoreRuntime(RuntimeMoniker runtimeMoniker, string msBuildMoniker, string displayName)
3233
: base(runtimeMoniker, msBuildMoniker, displayName)
@@ -84,6 +85,7 @@ internal static CoreRuntime GetCurrentVersion()
8485
{ Major: 8 } => GetPlatformSpecific(Core80, assembly),
8586
{ Major: 9 } => GetPlatformSpecific(Core90, assembly),
8687
{ Major: 10 } => GetPlatformSpecific(Core10_0, assembly),
88+
{ Major: 11 } => GetPlatformSpecific(Core11_0, assembly),
8789
_ => CreateForNewVersion($"net{version.Major}.{version.Minor}", $".NET {version.Major}.{version.Minor}"),
8890
};
8991

src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class MonoRuntime : Runtime, IEquatable<MonoRuntime>
1111
public static readonly MonoRuntime Mono80 = new("Mono with .NET 8.0", RuntimeMoniker.Mono80, "net8.0", isDotNetBuiltIn: true);
1212
public static readonly MonoRuntime Mono90 = new("Mono with .NET 9.0", RuntimeMoniker.Mono90, "net9.0", isDotNetBuiltIn: true);
1313
public static readonly MonoRuntime Mono10_0 = new("Mono with .NET 10.0", RuntimeMoniker.Mono10_0, "net10.0", isDotNetBuiltIn: true);
14+
public static readonly MonoRuntime Mono11_0 = new("Mono with .NET 11.0", RuntimeMoniker.Mono11_0, "net11.0", isDotNetBuiltIn: true);
1415

1516
public string CustomPath { get; }
1617

src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public class NativeAotRuntime : Runtime
2626
/// NativeAOT compiled as net10.0
2727
/// </summary>
2828
public static readonly NativeAotRuntime Net10_0 = new NativeAotRuntime(RuntimeMoniker.NativeAot10_0, "net10.0", "NativeAOT 10.0");
29+
/// <summary>
30+
/// NativeAOT compiled as net11.0
31+
/// </summary>
32+
public static readonly NativeAotRuntime Net11_0 = new NativeAotRuntime(RuntimeMoniker.NativeAot11_0, "net11.0", "NativeAOT 11.0");
2933

3034
public override bool IsAOT => true;
3135

@@ -53,6 +57,7 @@ public static NativeAotRuntime GetCurrentVersion()
5357
case Version v when v.Major == 8 && v.Minor == 0: return Net80;
5458
case Version v when v.Major == 9 && v.Minor == 0: return Net90;
5559
case Version v when v.Major == 10 && v.Minor == 0: return Net10_0;
60+
case Version v when v.Major == 11 && v.Minor == 0: return Net11_0;
5661
default:
5762
return new NativeAotRuntime(RuntimeMoniker.NotRecognized, $"net{version.Major}.{version.Minor}", $"NativeAOT {version.Major}.{version.Minor}");
5863
}

src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
4646
return CoreRuntime.Core90;
4747
case RuntimeMoniker.Net10_0:
4848
return CoreRuntime.Core10_0;
49+
case RuntimeMoniker.Net11_0:
50+
return CoreRuntime.Core11_0;
4951
case RuntimeMoniker.Mono:
5052
return MonoRuntime.Default;
5153
case RuntimeMoniker.NativeAot60:
@@ -58,6 +60,8 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
5860
return NativeAotRuntime.Net90;
5961
case RuntimeMoniker.NativeAot10_0:
6062
return NativeAotRuntime.Net10_0;
63+
case RuntimeMoniker.NativeAot11_0:
64+
return NativeAotRuntime.Net11_0;
6165
case RuntimeMoniker.Mono60:
6266
return MonoRuntime.Mono60;
6367
case RuntimeMoniker.Mono70:
@@ -68,6 +72,8 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
6872
return MonoRuntime.Mono90;
6973
case RuntimeMoniker.Mono10_0:
7074
return MonoRuntime.Mono10_0;
75+
case RuntimeMoniker.Mono11_0:
76+
return MonoRuntime.Mono11_0;
7177
default:
7278
throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, "Runtime Moniker not supported");
7379
}
@@ -93,29 +99,34 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
9399
RuntimeMoniker.Net80 => new Version(8, 0),
94100
RuntimeMoniker.Net90 => new Version(9, 0),
95101
RuntimeMoniker.Net10_0 => new Version(10, 0),
102+
RuntimeMoniker.Net11_0 => new Version(11, 0),
96103
RuntimeMoniker.NativeAot60 => new Version(6, 0),
97104
RuntimeMoniker.NativeAot70 => new Version(7, 0),
98105
RuntimeMoniker.NativeAot80 => new Version(8, 0),
99106
RuntimeMoniker.NativeAot90 => new Version(9, 0),
100107
RuntimeMoniker.NativeAot10_0 => new Version(10, 0),
108+
RuntimeMoniker.NativeAot11_0 => new Version(11, 0),
101109
RuntimeMoniker.Mono60 => new Version(6, 0),
102110
RuntimeMoniker.Mono70 => new Version(7, 0),
103111
RuntimeMoniker.Mono80 => new Version(8, 0),
104112
RuntimeMoniker.Mono90 => new Version(9, 0),
105113
RuntimeMoniker.Mono10_0 => new Version(10, 0),
114+
RuntimeMoniker.Mono11_0 => new Version(11, 0),
106115
RuntimeMoniker.Wasm => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? version : new Version(5, 0),
107116
RuntimeMoniker.WasmNet50 => new Version(5, 0),
108117
RuntimeMoniker.WasmNet60 => new Version(6, 0),
109118
RuntimeMoniker.WasmNet70 => new Version(7, 0),
110119
RuntimeMoniker.WasmNet80 => new Version(8, 0),
111120
RuntimeMoniker.WasmNet90 => new Version(9, 0),
112121
RuntimeMoniker.WasmNet10_0 => new Version(10, 0),
122+
RuntimeMoniker.WasmNet11_0 => new Version(11, 0),
113123
RuntimeMoniker.MonoAOTLLVM => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? version : new Version(6, 0),
114124
RuntimeMoniker.MonoAOTLLVMNet60 => new Version(6, 0),
115125
RuntimeMoniker.MonoAOTLLVMNet70 => new Version(7, 0),
116126
RuntimeMoniker.MonoAOTLLVMNet80 => new Version(8, 0),
117127
RuntimeMoniker.MonoAOTLLVMNet90 => new Version(9, 0),
118128
RuntimeMoniker.MonoAOTLLVMNet10_0 => new Version(10, 0),
129+
RuntimeMoniker.MonoAOTLLVMNet11_0 => new Version(11, 0),
119130
_ => throw new NotImplementedException($"{nameof(GetRuntimeVersion)} not implemented for {runtimeMoniker}")
120131
};
121132
}

src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class CsProjCoreToolchain : Toolchain, IEquatable<CsProjCoreToolchain>
2626
[PublicAPI] public static readonly IToolchain NetCoreApp80 = From(NetCoreAppSettings.NetCoreApp80);
2727
[PublicAPI] public static readonly IToolchain NetCoreApp90 = From(NetCoreAppSettings.NetCoreApp90);
2828
[PublicAPI] public static readonly IToolchain NetCoreApp10_0 = From(NetCoreAppSettings.NetCoreApp10_0);
29+
[PublicAPI] public static readonly IToolchain NetCoreApp11_0 = From(NetCoreAppSettings.NetCoreApp11_0);
2930

3031
internal CsProjCoreToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath)
3132
: base(name, generator, builder, executor)

0 commit comments

Comments
 (0)