Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<Nullable>annotations</Nullable>
<!-- Lets supress the "System.Collections.Immutable 8.0.0 doesn't support netcoreapp3.1" warning -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting, I wonder if that works for netcoreapp2.0, and if we could revert #2505.

<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/BenchmarkDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<PackageReference Include="Perfolizer" Version="[0.4.0]" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.8" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
<!-- Do not update these packages, or else netcoreapp3.1 may no longer work -->
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
Expand Down
13 changes: 10 additions & 3 deletions src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,17 @@ private static string GetCoreRunToolchainDisplayName(IReadOnlyList<FileInfo> pat
internal static bool TryParse(string runtime, out RuntimeMoniker runtimeMoniker)
{
int index = runtime.IndexOf('-');
if (index >= 0)
{
runtime = runtime.Substring(0, index);
}

return index < 0
? Enum.TryParse<RuntimeMoniker>(runtime.Replace(".", string.Empty), ignoreCase: true, out runtimeMoniker)
: Enum.TryParse<RuntimeMoniker>(runtime.Substring(0, index).Replace(".", string.Empty), ignoreCase: true, out runtimeMoniker);
// Monikers older than Net 10 don't use any version delimiter, newer monikers use _ delimiter.
if (Enum.TryParse(runtime.Replace(".", string.Empty), ignoreCase: true, out runtimeMoniker))
{
return true;
}
return Enum.TryParse(runtime.Replace('.', '_'), ignoreCase: true, out runtimeMoniker);
}
}
}
6 changes: 6 additions & 0 deletions tests/BenchmarkDotNet.Tests/ConfigParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,17 @@ public void NetFrameworkMonikerParsedCorrectly(string tfm)

[Theory]
[InlineData("net50")]
[InlineData("net5.0")]
[InlineData("net60")]
[InlineData("net6.0")]
[InlineData("net70")]
[InlineData("net7.0")]
[InlineData("net80")]
[InlineData("net8.0")]
[InlineData("net90")]
[InlineData("net9.0")]
[InlineData("net10_0")]
[InlineData("net10.0")]
public void NetMonikersAreRecognizedAsNetCoreMonikers(string tfm)
{
var config = ConfigParser.Parse(new[] { "-r", tfm }, new OutputLogger(Output)).config;
Expand Down
Loading