Skip to content

Commit df29aba

Browse files
committed
SuppressTfmSupportBuildWarnings in generated projects.
Updated MultipleFrameworks tests.
1 parent d71b626 commit df29aba

File tree

8 files changed

+13
-17
lines changed

8 files changed

+13
-17
lines changed

build/common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2424

2525
<Nullable>annotations</Nullable>
26-
<!-- Lets supress the "System.Collections.Immutable 8.0.0 doesn't support netcoreapp3.1" warning -->
26+
<!-- Suppress "System.Collections.Immutable 8.0.0 doesn't support netcoreapp3.1" warning -->
2727
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
2828
</PropertyGroup>
2929

src/BenchmarkDotNet/BenchmarkDotNet.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.8" PrivateAssets="contentfiles;analyzers" />
2424
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
2525
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
26-
<PackageReference Include="System.Management" Version="8.0.0" />
26+
<PackageReference Include="System.Management" Version="6.0.0" />
2727
</ItemGroup>
2828
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
2929
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />

src/BenchmarkDotNet/Templates/CsProj.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
2727
<!-- fix for NETSDK1150: https://docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/5.0/referencing-executable-generates-error -->
2828
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
29+
<!-- fix System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp2.0 -->
30+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
2931
<StartupObject>BenchmarkDotNet.Autogenerated.UniqueProgramName</StartupObject>
3032
</PropertyGroup>
3133

src/BenchmarkDotNet/Templates/MonoAOTLLVMCsProj.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2121
<StartupObject>BenchmarkDotNet.Autogenerated.UniqueProgramName</StartupObject>
2222
<SelfContained>true</SelfContained>
23+
<!-- fix System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp2.0 -->
24+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
2325
</PropertyGroup>
2426

2527
<ItemGroup>

src/BenchmarkDotNet/Templates/WasmCsProj.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
2727
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
2828
<EnableDefaultWasmAssembliesToBundle>false</EnableDefaultWasmAssembliesToBundle>
29+
<!-- fix System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp2.0 -->
30+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
2931
<StartupObject>BenchmarkDotNet.Autogenerated.UniqueProgramName</StartupObject>
3032
</PropertyGroup>
3133

src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ private string GenerateProjectForNuGetBuild(BuildPartition buildPartition, Artif
143143
<EnsureNETCoreAppRuntime>false</EnsureNETCoreAppRuntime> <!-- workaround for 'This runtime may not be supported by.NET Core.' error -->
144144
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> <!-- workaround for 'Found multiple publish output files with the same relative path.' error -->
145145
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
146+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> <!-- fix System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp2.0 -->
146147
{GetInstructionSetSettings(buildPartition)}
147148
</PropertyGroup>
148149
{GetRuntimeSettings(buildPartition.RepresentativeBenchmarkCase.Job.Environment.Gc, buildPartition.Resolver)}

tests/BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks/BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks.csproj

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,10 @@
33
<PropertyGroup>
44
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks</AssemblyTitle>
55
<!-- We test the oldest frameworks supported by BDN (net461 and netcoreapp2.0), as well as newer versions of those frameworks. -->
6+
<TargetFrameworks>net461;net48;netcoreapp2.0;net8.0</TargetFrameworks>
7+
<!-- Deprecated runtime and vulnerabilities from old runtime, just in case any are found in the future. -->
8+
<NoWarn>$(NoWarn);NETSDK1138;NU1901;NU1902;NU1903;NU1904</NoWarn>
69
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
7-
<!-- Using netcoreapp2.0 and net461 as one of the target frameworks leads to the following problems:-->
8-
<!-- * NU1903: Package 'Microsoft.NETCore.App' 2.0.0 has a known high severity vulnerability -->
9-
<!-- * Incompability with xunit.runner.visualstudio 2.4.2+ -->
10-
<!-- Therefore, we don't use it explicitly in the source code base to avoid persistent warnings -->
11-
<!-- If you need it for local backward compatibility experiments, do the following: -->
12-
<!-- 1. Add 'netcoreapp2.0;net461' in the list of TargetFrameworks -->
13-
<!-- 2. Add '<NoWarn>$(NoWarn);NU1903</NoWarn>' -->
14-
<!-- 3. Downgrade the xunit.runner.visualstudio NuGet package to v2.4.1 -->
15-
<!-- Please, do not commit these changes to the repository -->
16-
<TargetFrameworks>net462;net48;net8.0</TargetFrameworks>
1710
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1811
<AssemblyName>BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks</AssemblyName>
1912
<PackageId>BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks</PackageId>

tests/BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks/MultipleFrameworksTest.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
using BenchmarkDotNet.Configs;
44
using BenchmarkDotNet.Extensions;
55
using BenchmarkDotNet.Jobs;
6-
using BenchmarkDotNet.Portability;
76
using Xunit;
87

98
namespace BenchmarkDotNet.IntegrationTests.ManualRunning
109
{
11-
// Note: To properly test this locally, modify
12-
// BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks.csproj,
13-
// following the comments in that file.
1410
public class MultipleFrameworksTest : BenchmarkTestExecutor
1511
{
1612
private const string TfmEnvVarName = "TfmEnvVarName";
@@ -60,7 +56,7 @@ public void ThrowWhenWrong()
6056
{
6157
if (Environment.GetEnvironmentVariable(TfmEnvVarName) != moniker.ToString())
6258
{
63-
throw new InvalidOperationException($"Has not been recompiled, the value was {Environment.GetEnvironmentVariable(TfmEnvVarName)}");
59+
throw new InvalidOperationException($"Has not been recompiled, the value was {moniker}, expected {Environment.GetEnvironmentVariable(TfmEnvVarName)}");
6460
}
6561
}
6662
}

0 commit comments

Comments
 (0)