Skip to content

Commit 96e5d7b

Browse files
authored
chore: Modify mono toolchain behavior and remove mono90 or later definitions (dotnet#3004)
* chore: modify mono toolchain/runtime behavior * chore: remove mono90 or later runtimeMoniker/toolchain * chore: remove unneeded code based on review comment
1 parent c342c49 commit 96e5d7b

11 files changed

Lines changed: 14 additions & 70 deletions

File tree

src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,6 @@ public enum RuntimeMoniker
234234
/// </summary>
235235
Mono80,
236236

237-
/// <summary>
238-
/// .NET 9 using MonoVM (not CLR which is the default)
239-
/// </summary>
240-
Mono90,
241-
242-
/// <summary>
243-
/// .NET 10 using MonoVM (not CLR which is the default)
244-
/// </summary>
245-
Mono10_0,
246-
247-
/// <summary>
248-
/// .NET 11 using MonoVM (not CLR which is the default)
249-
/// </summary>
250-
Mono11_0,
251-
252237
/// <summary>
253238
/// .NET 8 CLR with composite ReadyToRun compilation
254239
/// </summary>

src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
118118
case RuntimeMoniker.Mono60:
119119
case RuntimeMoniker.Mono70:
120120
case RuntimeMoniker.Mono80:
121-
case RuntimeMoniker.Mono90:
122-
case RuntimeMoniker.Mono10_0:
123-
case RuntimeMoniker.Mono11_0:
124121
return false;
125122
case RuntimeMoniker.NetCoreApp20:
126123
case RuntimeMoniker.NetCoreApp21:

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
121121
case RuntimeMoniker.Mono60:
122122
case RuntimeMoniker.Mono70:
123123
case RuntimeMoniker.Mono80:
124-
case RuntimeMoniker.Mono90:
125-
case RuntimeMoniker.Mono10_0:
126-
case RuntimeMoniker.Mono11_0:
127124
return false;
128125
case RuntimeMoniker.NetCoreApp20:
129126
case RuntimeMoniker.NetCoreApp21:

src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -633,15 +633,6 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
633633
case RuntimeMoniker.Mono80:
634634
return MakeMonoJob(baseJob, options, MonoRuntime.Mono80);
635635

636-
case RuntimeMoniker.Mono90:
637-
return MakeMonoJob(baseJob, options, MonoRuntime.Mono90);
638-
639-
case RuntimeMoniker.Mono10_0:
640-
return MakeMonoJob(baseJob, options, MonoRuntime.Mono10_0);
641-
642-
case RuntimeMoniker.Mono11_0:
643-
return MakeMonoJob(baseJob, options, MonoRuntime.Mono11_0);
644-
645636
case RuntimeMoniker.R2R80:
646637
case RuntimeMoniker.R2R90:
647638
case RuntimeMoniker.R2R10_0:

src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ public class MonoRuntime : Runtime, IEquatable<MonoRuntime>
1111
public static readonly MonoRuntime Mono60 = new("Mono with .NET 6.0", RuntimeMoniker.Mono60, "net6.0", isDotNetBuiltIn: true);
1212
public static readonly MonoRuntime Mono70 = new("Mono with .NET 7.0", RuntimeMoniker.Mono70, "net7.0", isDotNetBuiltIn: true);
1313
public static readonly MonoRuntime Mono80 = new("Mono with .NET 8.0", RuntimeMoniker.Mono80, "net8.0", isDotNetBuiltIn: true);
14-
public static readonly MonoRuntime Mono90 = new("Mono with .NET 9.0", RuntimeMoniker.Mono90, "net9.0", isDotNetBuiltIn: true);
15-
public static readonly MonoRuntime Mono10_0 = new("Mono with .NET 10.0", RuntimeMoniker.Mono10_0, "net10.0", isDotNetBuiltIn: true);
16-
public static readonly MonoRuntime Mono11_0 = new("Mono with .NET 11.0", RuntimeMoniker.Mono11_0, "net11.0", isDotNetBuiltIn: true);
1714

1815
public string CustomPath { get; } = "";
1916

src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
6868
return MonoRuntime.Mono70;
6969
case RuntimeMoniker.Mono80:
7070
return MonoRuntime.Mono80;
71-
case RuntimeMoniker.Mono90:
72-
return MonoRuntime.Mono90;
73-
case RuntimeMoniker.Mono10_0:
74-
return MonoRuntime.Mono10_0;
75-
case RuntimeMoniker.Mono11_0:
76-
return MonoRuntime.Mono11_0;
7771
case RuntimeMoniker.R2R80:
7872
return R2RRuntime.Net80;
7973
case RuntimeMoniker.R2R90:
@@ -117,9 +111,6 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
117111
RuntimeMoniker.Mono60 => new Version(6, 0),
118112
RuntimeMoniker.Mono70 => new Version(7, 0),
119113
RuntimeMoniker.Mono80 => new Version(8, 0),
120-
RuntimeMoniker.Mono90 => new Version(9, 0),
121-
RuntimeMoniker.Mono10_0 => new Version(10, 0),
122-
RuntimeMoniker.Mono11_0 => new Version(11, 0),
123114
RuntimeMoniker.Wasm => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? version : new Version(5, 0),
124115
RuntimeMoniker.WasmNet50 => new Version(5, 0),
125116
RuntimeMoniker.WasmNet60 => new Version(6, 0),

src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,6 @@ public static int Main(string[] args)
192192
// TODO: Add Aliases here for extern alias #2289
193193
}
194194

195-
// Mono80IsSupported test fails when BenchmarkDotNet is restored for net9.0 if we don't remove the ProjectReference.
196-
// We still need to preserve the ProjectReference in every other case for disassembly, though.
197-
if (XUnitHelper.IsIntegrationTest.Value && this is MonoGenerator)
198-
{
199-
projectElement.RemoveChild(projectElement.SelectSingleNode("ItemGroup/ProjectReference")!.ParentNode!);
200-
}
201-
202195
xmlDoc.Save(artifactsPaths.ProjectFilePath);
203196
}
204197

src/BenchmarkDotNet/Toolchains/Mono/MonoGenerator.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@ public MonoGenerator(string targetFrameworkMoniker, string cliPath, string packa
1212

1313
protected override string GetRuntimeSettings(GcMode gcMode, IResolver resolver)
1414
{
15-
// Workaround for 'Found multiple publish output files with the same relative path' error
16-
return base.GetRuntimeSettings(gcMode, resolver) + "<PropertyGroup><ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles></PropertyGroup>";
15+
// Workaround for following issues.
16+
// 1. 'Found multiple publish output files with the same relative path' error
17+
// 2. NU1102 error occurs when running 'dotnet publish' on projects that contain .NET 9.0 or higher. https://github.com/dotnet/BenchmarkDotNet/issues/3000
18+
return base.GetRuntimeSettings(gcMode, resolver) +
19+
"""
20+
<PropertyGroup>
21+
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
22+
</PropertyGroup>
23+
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
24+
<UseMonoRuntime>true</UseMonoRuntime>
25+
</PropertyGroup>
26+
""";
1727
}
1828
}
1929
}

src/BenchmarkDotNet/Toolchains/Mono/MonoPublisher.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Collections.Generic;
2-
using BenchmarkDotNet.Jobs;
3-
using BenchmarkDotNet.Loggers;
1+
using BenchmarkDotNet.Loggers;
42
using BenchmarkDotNet.Running;
53
using BenchmarkDotNet.Toolchains.DotNetCli;
64
using BenchmarkDotNet.Toolchains.Results;
@@ -26,6 +24,6 @@ private static string GetExtraArguments()
2624
{
2725
var runtimeIdentifier = CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier();
2826
// /p:RuntimeIdentifiers is set explicitly here because --self-contained requires it, see https://github.com/dotnet/sdk/issues/10566
29-
return $"--self-contained -r {runtimeIdentifier} /p:UseMonoRuntime=true /p:RuntimeIdentifiers={runtimeIdentifier}";
27+
return $"--self-contained -r {runtimeIdentifier} /p:RuntimeIdentifiers={runtimeIdentifier}";
3028
}
3129
}

src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ public class MonoToolchain : CsProjCoreToolchain, IEquatable<MonoToolchain>
1111
[PublicAPI] public static readonly IToolchain Mono60 = From(new NetCoreAppSettings("net6.0", null, "mono60"));
1212
[PublicAPI] public static readonly IToolchain Mono70 = From(new NetCoreAppSettings("net7.0", null, "mono70"));
1313
[PublicAPI] public static readonly IToolchain Mono80 = From(new NetCoreAppSettings("net8.0", null, "mono80"));
14-
[PublicAPI] public static readonly IToolchain Mono90 = From(new NetCoreAppSettings("net9.0", null, "mono90"));
15-
[PublicAPI] public static readonly IToolchain Mono10_0 = From(new NetCoreAppSettings("net10.0", null, "mono10_0"));
16-
[PublicAPI] public static readonly IToolchain Mono11_0 = From(new NetCoreAppSettings("net11.0", null, "mono11_0"));
1714

1815
private MonoToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath)
1916
: base(name, generator, builder, executor, customDotNetCliPath)

0 commit comments

Comments
 (0)