Skip to content

Commit 76b3b75

Browse files
committed
Removed support for netcoreapp3.0 and older runtimes.
1 parent 570eeef commit 76b3b75

File tree

39 files changed

+141
-177
lines changed

39 files changed

+141
-177
lines changed

docs/articles/configs/toolchains.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ When you run your benchmarks without specifying the toolchain in an explicit way
1818
If you want to test multiple frameworks, your project file **MUST target all of them** and you **MUST install the corresponding SDKs**:
1919

2020
```xml
21-
<TargetFrameworks>netcoreapp3.0;netcoreapp2.1;net48</TargetFrameworks>
21+
<TargetFrameworks>netcoreapp3.1;net8.0;net48</TargetFrameworks>
2222
```
2323

2424
If you run your benchmarks without specifying any custom settings, BenchmarkDotNet is going to run the benchmarks **using the same framework as the host process**:
2525

2626
```cmd
27-
dotnet run -c Release -f netcoreapp2.1 # is going to run the benchmarks using .NET Core 2.1
28-
dotnet run -c Release -f netcoreapp3.0 # is going to run the benchmarks using .NET Core 3.0
27+
dotnet run -c Release -f netcoreapp3.1 # is going to run the benchmarks using .NET Core 3.1
28+
dotnet run -c Release -f net8.0 # is going to run the benchmarks using .NET 8.0
2929
dotnet run -c Release -f net48 # is going to run the benchmarks using .NET 4.8
3030
mono $pathToExe # is going to run the benchmarks using Mono from your PATH
3131
```
3232

3333
To run the benchmarks for multiple runtimes with a single command, you need to specify the target framework moniker names via `--runtimes|-r` console argument:
3434

3535
```cmd
36-
dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp2.1 netcoreapp3.0 # is going to run the benchmarks using .NET Core 2.1 and .NET Core 3.0
37-
dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp2.1 net48 # is going to run the benchmarks using .NET Core 2.1 and .NET 4.8
36+
dotnet run -c Release -f net8.0 --runtimes net8.0 netcoreapp3.1 # is going to run the benchmarks using .NET 8.0 and .NET Core 3.1
37+
dotnet run -c Release -f net8.0 --runtimes net8.0 net48 # is going to run the benchmarks using .NET 8.0 and .NET 4.8
3838
```
3939

4040
What is going to happen if you provide multiple Full .NET Framework monikers? Let's say:
@@ -67,8 +67,8 @@ namespace BenchmarkDotNet.Samples
6767
{
6868
[SimpleJob(RuntimeMoniker.Net48)]
6969
[SimpleJob(RuntimeMoniker.Mono)]
70-
[SimpleJob(RuntimeMoniker.NetCoreApp21)]
71-
[SimpleJob(RuntimeMoniker.NetCoreApp30)]
70+
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
71+
[SimpleJob(RuntimeMoniker.Net80)]
7272
public class TheClassWithBenchmarks
7373
```
7474

@@ -115,9 +115,9 @@ public class MyConfig : ManualConfig
115115
Add(Job.Default.With(
116116
CsProjCoreToolchain.From(
117117
new NetCoreAppSettings(
118-
targetFrameworkMoniker: "netcoreapp2.1",
119-
runtimeFrameworkVersion: "2.1.0-preview2-25628-01",
120-
name: ".NET Core 2.1"))));
118+
targetFrameworkMoniker: "net8.0-windows",
119+
runtimeFrameworkVersion: "8.0.101",
120+
name: ".NET 8.0 Windows"))));
121121
}
122122
}
123123
```
@@ -146,11 +146,11 @@ public class CustomPathsConfig : ManualConfig
146146
public CustomPathsConfig()
147147
{
148148
var dotnetCli32bit = NetCoreAppSettings
149-
.NetCoreApp20
149+
.NetCoreApp31
150150
.WithCustomDotNetCliPath(@"C:\Program Files (x86)\dotnet\dotnet.exe", "32 bit cli");
151151

152152
var dotnetCli64bit = NetCoreAppSettings
153-
.NetCoreApp20
153+
.NetCoreApp31
154154
.WithCustomDotNetCliPath(@"C:\Program Files\dotnet\dotnet.exe", "64 bit cli");
155155

156156
Add(Job.RyuJitX86.With(CsProjCoreToolchain.From(dotnetCli32bit)).WithId("32 bit cli"));

docs/articles/faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ See also: [BenchmarkDotNet#237](https://github.com/dotnet/BenchmarkDotNet/issues
1313

1414
* **Q** Why can't I install BenchmarkDotNet in a new .NET Core Console App in Visual Studio 2017?
1515

16-
**A** BenchmarkDotNet supports only netcoreapp2.0+.
16+
**A** BenchmarkDotNet supports only netcoreapp3.1+.
1717
Some old Visual Studio 2017 can create a new application which targets netcoreapp1.0.
18-
You should upgrade it up to 2.0.
18+
You should upgrade it up to 3.1.
1919
If you want to target netcoreapp1.0 in your main assembly, it's recommended to create a separated project for benchmarks.
2020

2121
* **Q** I created a new .NET Core Console App in Visual Studio 2017. Now I want to run my code on CoreCLR, full .NET Framework, and Mono. How can I do it?
2222

2323
**A** Use the following lines in your `.csproj` file:
2424

2525
```xml
26-
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
26+
<TargetFrameworks>netcoreapp3.1;net46</TargetFrameworks>
2727
<PlatformTarget>AnyCPU</PlatformTarget>
2828
```
2929

@@ -33,7 +33,7 @@ If you want to target netcoreapp1.0 in your main assembly, it's recommended to c
3333
[CoreJob, ClrJob, MonoJob]
3434
```
3535

36-
* **Q** My source code targets old versions of .NET Framework or .NET Core, but BenchmarkDotNet requires `net461` and `netcoreapp2.0`. How can I run benchmarks in this case?
36+
* **Q** My source code targets old versions of .NET Framework or .NET Core, but BenchmarkDotNet requires `net461` and `netcoreapp3.1`. How can I run benchmarks in this case?
3737

3838
**A** It's a good practice to introduce an additional console application (e.g. `MyAwesomeLibrary.Benchmarks`) which will depend on your code and BenchmarkDotNet.
3939
Due to the fact that users usually run benchmarks in a develop environment and don't distribute benchmarks for users, it shouldn't be a problem.

docs/articles/guides/console-args.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,28 @@ You can also filter the benchmarks by categories:
117117
The `--runtimes` or just `-r` allows you to run the benchmarks for selected Runtimes. Available options are:
118118

119119
* Clr - BDN will either use Roslyn (if you run it as .NET app) or latest installed .NET SDK to build the benchmarks (if you run it as .NET Core app).
120-
* Core - if you run it as .NET Core app, BDN will use the same target framework moniker, if you run it as .NET app it's going to use netcoreapp2.1.
120+
* Core - if you run it as .NET Core app, BDN will use the same target framework moniker, if you run it as .NET app it's going to use net8.0.
121121
* Mono - it's going to use the Mono from `$Path`, you can override it with `--monoPath`.
122122
* net46, net461, net462, net47, net471, net472 - to build and run benchmarks against specific .NET framework version.
123-
* netcoreapp2.0, netcoreapp2.1, netcoreapp2.2, netcoreapp3.0, netcoreapp3.1, net5.0, net6.0, net7.0 - to build and run benchmarks against specific .NET Core version.
124-
* nativeaot5.0, nativeaot6.0, nativeaot7.0 - to build and run benchmarks using NativeAOT. Can be customized with additional options: `--ilcPath`, `--ilCompilerVersion`.
123+
* netcoreapp3.1, net5.0, net6.0, net7.0, net8.0 - to build and run benchmarks against specific .NET Core version.
124+
* nativeaot5.0, nativeaot6.0, nativeaot7.0, , nativeaot8.0 - to build and run benchmarks using NativeAOT. Can be customized with additional options: `--ilcPath`, `--ilCompilerVersion`.
125125

126-
Example: run the benchmarks for .NET 4.7.2 and .NET Core 2.1:
126+
Example: run the benchmarks for .NET 4.7.2 and .NET 8.0:
127127

128128
```log
129-
dotnet run -c Release -- --runtimes net472 netcoreapp2.1
129+
dotnet run -c Release -- --runtimes net472 net8.0
130130
```
131131

132-
Example: run the benchmarks for .NET Core 3.0 and latest .NET SDK installed on your PC:
132+
Example: run the benchmarks for .NET Core 3.1 and latest .NET SDK installed on your PC:
133133

134134
```log
135-
dotnet run -c Release -f netcoreapp3.0 -- --runtimes clr core
135+
dotnet run -c Release -f netcoreapp3.1 -- --runtimes clr core
136136
```
137137

138-
But same command executed with `-f netcoreapp2.0` is going to run the benchmarks for .NET Core 2.0:
138+
But same command executed with `-f net6.0` is going to run the benchmarks for .NET 6.0:
139139

140140
```log
141-
dotnet run -c Release -f netcoreapp2.0 -- --runtimes clr core
141+
dotnet run -c Release -f net6.0 -- --runtimes clr core
142142
```
143143

144144
## Number of invocations and iterations
@@ -207,10 +207,10 @@ To perform a Mann–Whitney U Test and display the results in a dedicated column
207207

208208
* `--statisticalTest`- Threshold for Mann–Whitney U Test. Examples: 5%, 10ms, 100ns, 1s
209209

210-
Example: run Mann–Whitney U test with relative ratio of 5% for all benchmarks for .NET Core 2.0 (base) vs .NET Core 2.1 (diff). .NET Core 2.0 will be baseline because it was first.
210+
Example: run Mann–Whitney U test with relative ratio of 5% for all benchmarks for .NET 6.0 (base) vs .NET 8.0 (diff). .NET 6.0 will be baseline because it was first.
211211

212212
```log
213-
dotnet run -c Release -- --filter * --runtimes netcoreapp2.0 netcoreapp2.1 --statisticalTest 5%
213+
dotnet run -c Release -- --filter * --runtimes net6.0 net8.0 --statisticalTest 5%
214214
```
215215

216216
## More

docs/articles/guides/troubleshooting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ How do you know that BenchmarkDotNet has failed to build the project? BDN is goi
1111
// ***** BenchmarkRunner: Start *****
1212
// ***** Found 1 benchmark(s) in total *****
1313
// ***** Building 1 exe(s) in Parallel: Start *****
14-
// start dotnet restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\netcoreapp2.1\c6045772-d3c7-4dbe-ab37-4aca6dcb6ec4
14+
// start dotnet restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\net8.0\c6045772-d3c7-4dbe-ab37-4aca6dcb6ec4
1515
// command took 0.51s and exited with 1
1616
// ***** Done, took 00:00:00 (0.66 sec) *****
1717
// Found 1 benchmarks:
@@ -20,10 +20,10 @@ How do you know that BenchmarkDotNet has failed to build the project? BDN is goi
2020
// Build Error: Standard output:
2121
2222
Standard error:
23-
C:\Projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\netcoreapp2.1\c6045772-d3c7-4dbe-ab37-4aca6dcb6ec4\BenchmarkDotNet.Autogenerated.csproj(36,1): error MSB4025: The project file could not be loaded. Unexpected end of file while parsing Comment has occurred. Line 36, position 1.
23+
C:\Projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\net8.0\c6045772-d3c7-4dbe-ab37-4aca6dcb6ec4\BenchmarkDotNet.Autogenerated.csproj(36,1): error MSB4025: The project file could not be loaded. Unexpected end of file while parsing Comment has occurred. Line 36, position 1.
2424
2525
// BenchmarkDotNet has failed to build the auto-generated boilerplate code.
26-
// It can be found in C:\Projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\netcoreapp2.1\c6045772-d3c7-4dbe-ab37-4aca6dcb6ec4
26+
// It can be found in C:\Projects\BenchmarkDotNet\samples\BenchmarkDotNet.Samples\bin\Release\net8.0\c6045772-d3c7-4dbe-ab37-4aca6dcb6ec4
2727
// Please follow the troubleshooting guide: https://benchmarkdotnet.org/articles/guides/troubleshooting.html
2828
```
2929

samples/BenchmarkDotNet.Samples/IntroEnvVars.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ private class ConfigWithCustomEnvVars : ManualConfig
1414

1515
public ConfigWithCustomEnvVars()
1616
{
17-
AddJob(Job.Default.WithRuntime(CoreRuntime.Core21).WithId("Inlining enabled"));
18-
AddJob(Job.Default.WithRuntime(CoreRuntime.Core21)
17+
AddJob(Job.Default.WithRuntime(CoreRuntime.Core80).WithId("Inlining enabled"));
18+
AddJob(Job.Default.WithRuntime(CoreRuntime.Core80)
1919
.WithEnvironmentVariables(new EnvironmentVariable(JitNoInline, "1"))
2020
.WithId("Inlining disabled"));
2121
}

samples/BenchmarkDotNet.Samples/IntroFluentConfigBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static void Run()
3838
.Run<Algo_Md5VsSha256>(
3939
DefaultConfig.Instance
4040
.AddJob(Job.Default.WithRuntime(ClrRuntime.Net462))
41-
.AddJob(Job.Default.WithRuntime(CoreRuntime.Core21))
41+
.AddJob(Job.Default.WithRuntime(CoreRuntime.Core80))
4242
.AddValidator(ExecutionValidator.FailOnError));
4343
}
4444
}

src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,27 @@ public enum RuntimeMoniker
5757
/// <summary>
5858
/// .NET Core 2.0
5959
/// </summary>
60-
NetCoreApp20,
60+
[Obsolete("This runtime is no longer supported. Use a newer runtime or use BenchmarkDotNet v0.13.X or older.", true)]
61+
// Assigning explicit values so we can check for them without the compiler erroring.
62+
NetCoreApp20 = 10,
6163

6264
/// <summary>
6365
/// .NET Core 2.1
6466
/// </summary>
65-
NetCoreApp21,
67+
[Obsolete("This runtime is no longer supported. Use a newer runtime or use BenchmarkDotNet v0.13.X or older.", true)]
68+
NetCoreApp21 = 11,
6669

6770
/// <summary>
6871
/// .NET Core 2.2
6972
/// </summary>
70-
NetCoreApp22,
73+
[Obsolete("This runtime is no longer supported. Use a newer runtime or use BenchmarkDotNet v0.13.X or older.", true)]
74+
NetCoreApp22 = 12,
7175

7276
/// <summary>
7377
/// .NET Core 3.0
7478
/// </summary>
75-
NetCoreApp30,
79+
[Obsolete("This runtime is no longer supported. Use a newer runtime or use BenchmarkDotNet v0.13.X or older.", true)]
80+
NetCoreApp30 = 13,
7681

7782
/// <summary>
7883
/// .NET Core 3.1

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ internal static bool IsSupported(RuntimeMoniker runtimeMoniker)
9999
case RuntimeMoniker.Net80:
100100
case RuntimeMoniker.Net90:
101101
return true;
102+
// netcoreapp20 - netcoreapp30 are no longer supported.
103+
case (RuntimeMoniker) 10:
104+
case (RuntimeMoniker) 11:
105+
case (RuntimeMoniker) 12:
106+
case (RuntimeMoniker) 13:
102107
case RuntimeMoniker.NotRecognized:
103108
case RuntimeMoniker.Mono:
104109
case RuntimeMoniker.NativeAot60:
@@ -124,11 +129,6 @@ internal static bool IsSupported(RuntimeMoniker runtimeMoniker)
124129
case RuntimeMoniker.NetCoreApp50:
125130
#pragma warning restore CS0618 // Type or member is obsolete
126131
return false;
127-
case RuntimeMoniker.NetCoreApp20:
128-
case RuntimeMoniker.NetCoreApp21:
129-
case RuntimeMoniker.NetCoreApp22:
130-
return RuntimeInformation.IsWindows();
131-
case RuntimeMoniker.NetCoreApp30:
132132
case RuntimeMoniker.NetCoreApp31:
133133
return RuntimeInformation.IsWindows() || RuntimeInformation.IsLinux();
134134
default:

src/BenchmarkDotNet/BenchmarkDotNet.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
<PackageReference Include="Perfolizer" Version="[0.2.1]" />
2424
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.0.2" PrivateAssets="contentfiles;analyzers" />
2525
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
26-
<!-- Do not update these packages, or else netcoreapp3.0 and older will no longer work -->
27-
<PackageReference Include="System.Management" Version="5.0.0" />
28-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" />
26+
<!-- Do not update these packages, or else netcoreapp3.1 may no longer work -->
27+
<PackageReference Include="System.Management" Version="6.0.0" />
28+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
2929
</ItemGroup>
3030
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
3131
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />

src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ public static IEnumerable<Example> Examples
237237

238238
yield return new Example("Use Job.ShortRun for running the benchmarks", shortName, new CommandLineOptions { BaseJob = "short" });
239239
yield return new Example("Run benchmarks in process", shortName, new CommandLineOptions { RunInProcess = true });
240-
yield return new Example("Run benchmarks for .NET 4.7.2, .NET Core 2.1 and Mono. .NET 4.7.2 will be baseline because it was first.", longName, new CommandLineOptions { Runtimes = new[] { "net472", "netcoreapp2.1", "Mono" } });
241-
yield return new Example("Run benchmarks for .NET Core 2.0, .NET Core 2.1 and .NET Core 2.2. .NET Core 2.0 will be baseline because it was first.", longName, new CommandLineOptions { Runtimes = new[] { "netcoreapp2.0", "netcoreapp2.1", "netcoreapp2.2" } });
240+
yield return new Example("Run benchmarks for .NET 4.7.2, .NET 8.0 and Mono. .NET 4.7.2 will be baseline because it was first.", longName, new CommandLineOptions { Runtimes = new[] { "net472", "net8.0", "Mono" } });
241+
yield return new Example("Run benchmarks for .NET Core 3.1, .NET 6.0 and .NET 8.0. .NET Core 3.1 will be baseline because it was first.", longName, new CommandLineOptions { Runtimes = new[] { "netcoreapp3.1", "net6.0", "net8.0" } });
242242
yield return new Example("Use MemoryDiagnoser to get GC stats", shortName, new CommandLineOptions { UseMemoryDiagnoser = true });
243243
yield return new Example("Use DisassemblyDiagnoser to get disassembly", shortName, new CommandLineOptions { UseDisassemblyDiagnoser = true });
244244
yield return new Example("Use HardwareCountersDiagnoser to get hardware counter info", longName, new CommandLineOptions { HardwareCounters = new[] { nameof(HardwareCounter.CacheMisses), nameof(HardwareCounter.InstructionRetired) } });
@@ -250,8 +250,8 @@ public static IEnumerable<Example> Examples
250250
yield return new Example("Run selected benchmarks once per iteration", longName, new CommandLineOptions { RunOncePerIteration = true });
251251
yield return new Example("Run selected benchmarks 100 times per iteration. Perform single warmup iteration and 5 actual workload iterations", longName, new CommandLineOptions { InvocationCount = 100, WarmupIterationCount = 1, IterationCount = 5});
252252
yield return new Example("Run selected benchmarks 250ms per iteration. Perform from 9 to 15 iterations", longName, new CommandLineOptions { IterationTimeInMilliseconds = 250, MinIterationCount = 9, MaxIterationCount = 15});
253-
yield return new Example("Run MannWhitney test with relative ratio of 5% for all benchmarks for .NET Core 2.0 (base) vs .NET Core 2.1 (diff). .NET Core 2.0 will be baseline because it was provided as first.", longName,
254-
new CommandLineOptions { Filters = new[] { "*"}, Runtimes = new[] { "netcoreapp2.0", "netcoreapp2.1" }, StatisticalTestThreshold = "5%" });
253+
yield return new Example("Run MannWhitney test with relative ratio of 5% for all benchmarks for .NET 6.0 (base) vs .NET 8.0 (diff). .NET Core 6.0 will be baseline because it was provided as first.", longName,
254+
new CommandLineOptions { Filters = new[] { "*"}, Runtimes = new[] { "net6.0", "net8.0" }, StatisticalTestThreshold = "5%" });
255255
yield return new Example("Run benchmarks using environment variables 'ENV_VAR_KEY_1' with value 'value_1' and 'ENV_VAR_KEY_2' with value 'value_2'", longName,
256256
new CommandLineOptions { EnvironmentVariables = new[] { "ENV_VAR_KEY_1:value_1", "ENV_VAR_KEY_2:value_2" } });
257257
yield return new Example("Hide Mean and Ratio columns (use double quotes for multi-word columns: \"Alloc Ratio\")", shortName, new CommandLineOptions { HiddenColumns = new[] { "Mean", "Ratio" }, });

0 commit comments

Comments
 (0)