Skip to content

Commit 53ff03e

Browse files
committed
chore: fix VSTestAdapter error for project that tageting net462
1 parent 9612c51 commit 53ff03e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/BenchmarkDotNet.TestAdapter/BenchmarkEnumerator.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ public static BenchmarkRunInfo[] GetBenchmarksFromAssemblyPath(string assemblyPa
3838
}
3939
}
4040

41+
if (eventArgs.Name.StartsWith("System.Collections.Immutable, Version="))
42+
{
43+
var baseDir = Path.GetDirectoryName(assemblyPath);
44+
var path = Path.Combine(baseDir, "System.Collections.Immutable.dll");
45+
if (File.Exists(path))
46+
{
47+
return Assembly.LoadFrom(path);
48+
}
49+
}
50+
51+
if (eventArgs.Name.StartsWith("System.Memory, Version="))
52+
{
53+
var baseDir = Path.GetDirectoryName(assemblyPath);
54+
var path = Path.Combine(baseDir, "System.Memory.dll");
55+
if (File.Exists(path))
56+
{
57+
return Assembly.LoadFrom(path);
58+
}
59+
}
60+
4161
// Fallback to default assembly resolver
4262
return null;
4363
};

0 commit comments

Comments
 (0)