File tree Expand file tree Collapse file tree 6 files changed +29
-10
lines changed
samples/BenchmarkDotNet.Samples
src/BenchmarkDotNet.TestAdapter
BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks
BenchmarkDotNet.IntegrationTests Expand file tree Collapse file tree 6 files changed +29
-10
lines changed Original file line number Diff line number Diff line change 1616 </PropertyGroup >
1717 <ItemGroup Condition =" '$(TargetFrameworkIdentifier)' == '.NETFramework' " >
1818 <Reference Include =" System.Reflection" />
19- <PackageReference Include =" System.Memory" Version =" 4.6.3" />
2019 </ItemGroup >
2120 <ItemGroup >
22- <!-- Use v9.0.3 as baseline package for WithNuGet tests -->
23- <PackageReference Include =" System.Collections.Immutable" Version =" 9.0.3 " />
21+ <!-- Use v9.0.0 as baseline package for WithNuGet tests -->
22+ <PackageReference Include =" System.Collections.Immutable" Version =" 9.0.0 " />
2423 </ItemGroup >
2524 <ItemGroup >
2625 <PackageReference Include =" System.Drawing.Common" Version =" 9.0.5" />
Original file line number Diff line number Diff line change @@ -27,15 +27,15 @@ public Config()
2727 var baseJob = Job . MediumRun ;
2828
2929 string [ ] targetVersions = [
30+ "9.0.0" ,
3031 "9.0.3" ,
31- "9.0.4" ,
3232 "9.0.5" ,
3333 ] ;
3434
3535 foreach ( var version in targetVersions )
3636 {
3737 AddJob ( baseJob . WithNuGet ( "System.Collections.Immutable" , version )
38- . WithId ( "v" + version ) ) ;
38+ . WithId ( $ "v { version } " ) ) ;
3939 }
4040 }
4141 }
Original file line number Diff line number Diff line change 33using BenchmarkDotNet . Running ;
44using BenchmarkDotNet . Toolchains ;
55using System ;
6- using System . Collections . Generic ;
6+ using System . IO ;
77using System . Linq ;
88using System . Reflection ;
99
@@ -21,6 +21,28 @@ internal static class BenchmarkEnumerator
2121 /// <returns>The benchmarks inside the assembly.</returns>
2222 public static BenchmarkRunInfo [ ] GetBenchmarksFromAssemblyPath ( string assemblyPath )
2323 {
24+ #if NET462
25+ // Temporary workaround for BenchmarkDotNet assembly loading issue that occurred under the following conditions:
26+ // 1. Run BenchmarkDotNet.Samples project with following command.
27+ // > dotnet test -c Release --list-tests --framework net462 -tl:off
28+ // 2. When using `BenchmarkDotNet.TestAdapter` package and targeting .NET Framework.
29+ AppDomain . CurrentDomain . AssemblyResolve += ( sender , eventArgs ) =>
30+ {
31+ if ( eventArgs . Name . StartsWith ( "BenchmarkDotNet, Version=" ) )
32+ {
33+ var baseDir = Path . GetDirectoryName ( assemblyPath ) ;
34+ var path = Path . Combine ( baseDir , "BenchmarkDotNet.dll" ) ;
35+ if ( File . Exists ( path ) )
36+ {
37+ return Assembly . LoadFrom ( path ) ;
38+ }
39+ }
40+
41+ // Fallback to default assembly resolver
42+ return null ;
43+ } ;
44+ #endif
45+
2446 var assembly = Assembly . LoadFrom ( assemblyPath ) ;
2547
2648 var isDebugAssembly = assembly . IsJitOptimizationDisabled ( ) ?? false ;
Original file line number Diff line number Diff line change 3030 </ItemGroup >
3131 <ItemGroup >
3232 <PackageReference Include =" Microsoft.NETCore.Platforms" Version =" 7.0.4" />
33- <PackageReference Include =" System.Memory" Version =" [4.5.5]" />
3433 </ItemGroup >
3534 <ItemGroup >
3635 <Content Include =" ..\BenchmarkDotNet.IntegrationTests.ManualRunning\xunit.runner.json" >
Original file line number Diff line number Diff line change 3535 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.14.1" />
3636 </ItemGroup >
3737 <ItemGroup >
38- <!-- Use v9.0.3 as baseline package for WithNuGet tests -->
39- <PackageReference Include =" System.Collections.Immutable" Version =" [9.0.3 ]" />
38+ <!-- Use v9.0.0 as baseline package for WithNuGet tests -->
39+ <PackageReference Include =" System.Collections.Immutable" Version =" [9.0.0 ]" />
4040 <PackageReference Include =" xunit" Version =" 2.9.3" />
4141 <PackageReference Include =" xunit.runner.visualstudio" Version =" [2.8.2]" >
4242 <PrivateAssets >all</PrivateAssets >
Original file line number Diff line number Diff line change 2626 <ItemGroup Condition =" '$(TargetFrameworkIdentifier)' == '.NETFramework' " >
2727 <ProjectReference Include =" ..\..\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj" />
2828 <PackageReference Include =" Microsoft.NETCore.Platforms" Version =" 7.0.4" />
29- <PackageReference Include =" System.Memory" Version =" 4.6.3" />
3029 <PackageReference Include =" System.Runtime.CompilerServices.Unsafe" Version =" 6.1.2" />
3130 <Reference Include =" System.Runtime" />
3231 <Reference Include =" System.Threading.Tasks" />
You can’t perform that action at this time.
0 commit comments