Skip to content

Commit 3a2d115

Browse files
authored
Removed support for netcoreapp3.0 and older runtimes. (#2505)
1 parent bc3abf9 commit 3a2d115

File tree

45 files changed

+159
-195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+159
-195
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The measured data can be exported to different formats (md, html, csv, xml, json
112112

113113
![](https://raw.githubusercontent.com/dotnet/BenchmarkDotNet/ec962b0bd6854c991d7a3ebd77037579165acb36/docs/images/v0.12.0/rplot.png)
114114

115-
*Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Mono, NativeAOT
115+
*Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 3.1+, Mono, NativeAOT
116116
*Supported languages:* C#, F#, Visual Basic
117117
*Supported OS:* Windows, Linux, macOS
118118
*Supported architectures:* x86, x64, ARM, ARM64, Wasm and LoongArch64
@@ -135,8 +135,8 @@ If you want to compare benchmarks with each other,
135135
mark one of the benchmarks as the [baseline](https://benchmarkdotnet.org/articles/features/baselines.html)
136136
via `[Benchmark(Baseline = true)]`: BenchmarkDotNet will compare it with all of the other benchmarks.
137137
If you want to compare performance in different environments, use [jobs](https://benchmarkdotnet.org/articles/configs/jobs.html).
138-
For example, you can run all the benchmarks on .NET Core 3.0 and Mono via
139-
`[SimpleJob(RuntimeMoniker.NetCoreApp30)]` and `[SimpleJob(RuntimeMoniker.Mono)]`.
138+
For example, you can run all the benchmarks on .NET Core 3.1 and Mono via
139+
`[SimpleJob(RuntimeMoniker.NetCoreApp31)]` and `[SimpleJob(RuntimeMoniker.Mono)]`.
140140

141141
If you don't like attributes, you can call most of the APIs via the fluent style and write code like this:
142142

docs/articles/configs/toolchains.md

+12-12
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
AddJob(Job.RyuJitX86.WithToolchain(CsProjCoreToolchain.From(dotnetCli32bit)).WithId("32 bit cli"));

docs/articles/faq.md

+4-4
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

+13-12
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,29 @@ 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`.
122-
* 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`.
122+
* net46, net461, net462, net47, net471, net472, net48, net481 - to build and run benchmarks against specific .NET Framework version.
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`.
125+
* mono6.0, mono7.0, mono8.0 - to build and run benchmarks with .Net 6+ using MonoVM.
125126

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

128129
```log
129-
dotnet run -c Release -- --runtimes net472 netcoreapp2.1
130+
dotnet run -c Release -- --runtimes net472 net8.0
130131
```
131132

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

134135
```log
135-
dotnet run -c Release -f netcoreapp3.0 -- --runtimes clr core
136+
dotnet run -c Release -f netcoreapp3.1 -- --runtimes clr core
136137
```
137138

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

140141
```log
141-
dotnet run -c Release -f netcoreapp2.0 -- --runtimes clr core
142+
dotnet run -c Release -f net6.0 -- --runtimes clr core
142143
```
143144

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

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

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.
211+
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.
211212

212213
```log
213-
dotnet run -c Release -- --filter * --runtimes netcoreapp2.0 netcoreapp2.1 --statisticalTest 5%
214+
dotnet run -c Release -- --filter * --runtimes net6.0 net8.0 --statisticalTest 5%
214215
```
215216

216217
## More

docs/articles/guides/troubleshooting.md

+3-3
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

docs/articles/overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Overview
1010
Create new console application and install the [BenchmarkDotNet](https://www.nuget.org/packages/BenchmarkDotNet/) NuGet package. We support:
1111

1212
* *Projects:* classic and modern with PackageReferences
13-
* *Runtimes:* Full .NET Framework (4.6+), .NET Core (2.0+), Mono, NativeAOT
13+
* *Runtimes:* Full .NET Framework (4.6+), .NET Core (3.1+), Mono, NativeAOT
1414
* *OS:* Windows, Linux, MacOS
1515
* *Languages:* C#, F#, VB
1616

samples/BenchmarkDotNet.Samples/IntroEnvVars.cs

+2-2
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

+1-1
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

+9-4
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.14.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.14.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.14.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.14.X or older.", true)]
80+
NetCoreApp30 = 13,
7681

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

src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs

-5
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
107107
case RuntimeMoniker.NetCoreApp50:
108108
#pragma warning restore CS0618 // Type or member is obsolete
109109
return false;
110-
case RuntimeMoniker.NetCoreApp20:
111-
case RuntimeMoniker.NetCoreApp21:
112-
case RuntimeMoniker.NetCoreApp22:
113-
return OsDetector.IsWindows();
114-
case RuntimeMoniker.NetCoreApp30:
115110
case RuntimeMoniker.NetCoreApp31:
116111
return OsDetector.IsWindows() || OsDetector.IsLinux();
117112
default:

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs

-5
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
110110
case RuntimeMoniker.NetCoreApp50:
111111
#pragma warning restore CS0618 // Type or member is obsolete
112112
return false;
113-
case RuntimeMoniker.NetCoreApp20:
114-
case RuntimeMoniker.NetCoreApp21:
115-
case RuntimeMoniker.NetCoreApp22:
116-
return OsDetector.IsWindows();
117-
case RuntimeMoniker.NetCoreApp30:
118113
case RuntimeMoniker.NetCoreApp31:
119114
return OsDetector.IsWindows() || OsDetector.IsLinux();
120115
default:

src/BenchmarkDotNet/BenchmarkDotNet.csproj

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

0 commit comments

Comments
 (0)