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
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<Reference Include="System.Reflection" />
<PackageReference Include="System.Memory" Version="4.6.3" />
</ItemGroup>
<ItemGroup>
<!-- Use v9.0.3 as baseline package for WithNuGet tests -->
<PackageReference Include="System.Collections.Immutable" Version="9.0.3" />
<!-- Use v9.0.0 as baseline package for WithNuGet tests -->
<PackageReference Include="System.Collections.Immutable" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
Expand Down
4 changes: 2 additions & 2 deletions samples/BenchmarkDotNet.Samples/IntroNuGet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public Config()
var baseJob = Job.MediumRun;

string[] targetVersions = [
"9.0.0",
"9.0.3",
"9.0.4",
"9.0.5",
];

foreach (var version in targetVersions)
{
AddJob(baseJob.WithNuGet("System.Collections.Immutable", version)
.WithId("v"+version));
.WithId($"v{version}"));
}
}
}
Expand Down
24 changes: 23 additions & 1 deletion src/BenchmarkDotNet.TestAdapter/BenchmarkEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Toolchains;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;

Expand All @@ -21,6 +21,28 @@ internal static class BenchmarkEnumerator
/// <returns>The benchmarks inside the assembly.</returns>
public static BenchmarkRunInfo[] GetBenchmarksFromAssemblyPath(string assemblyPath)
{
#if NET462
// Temporary workaround for BenchmarkDotNet assembly loading issue that occurred under the following conditions:
// 1. Run BenchmarkDotNet.Samples project with following command.
// > dotnet test -c Release --list-tests --framework net462 -tl:off
// 2. When using `BenchmarkDotNet.TestAdapter` package and targeting .NET Framework.
AppDomain.CurrentDomain.AssemblyResolve += (sender, eventArgs) =>
{
if (eventArgs.Name.StartsWith("BenchmarkDotNet, Version="))
{
var baseDir = Path.GetDirectoryName(assemblyPath);
var path = Path.Combine(baseDir, "BenchmarkDotNet.dll");
if (File.Exists(path))
{
return Assembly.LoadFrom(path);
}
}

// Fallback to default assembly resolver
return null;
};
#endif

var assembly = Assembly.LoadFrom(assemblyPath);

var isDebugAssembly = assembly.IsJitOptimizationDisabled() ?? false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageReference Include="System.Memory" Version="[4.5.5]" />
</ItemGroup>
<ItemGroup>
<Content Include="..\BenchmarkDotNet.IntegrationTests.ManualRunning\xunit.runner.json">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
</ItemGroup>
<ItemGroup>
<!-- Use v9.0.3 as baseline package for WithNuGet tests -->
<PackageReference Include="System.Collections.Immutable" Version="[9.0.3]" />
<!-- Use v9.0.0 as baseline package for WithNuGet tests -->
<PackageReference Include="System.Collections.Immutable" Version="[9.0.0]" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="[2.8.2]">
<PrivateAssets>all</PrivateAssets>
Expand Down
1 change: 0 additions & 1 deletion tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<ProjectReference Include="..\..\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageReference Include="System.Memory" Version="4.6.3" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
<Reference Include="System.Runtime" />
<Reference Include="System.Threading.Tasks" />
Expand Down