Skip to content

Commit 538cf00

Browse files
authored
Fix .NET 4.6.2 Discovery (#62)
* fix net462 discovery * Update CHANGELOG
1 parent c248170 commit 538cf00

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
* Fix: Error message box when creating feature file with space in its name (#50)
1111
* Fix: Error during discovery of .NET 4 projects when .NET 6.0 is not installed (#53)
12+
* Fix: Bindings cannot be discovered for .NET 4.6.2 projects (#62)
1213

1314
*Contributors of this release (in alphabetical order):* @gasparnagy, @RikvanSpreuwel
1415

Connectors/Reqnroll.VisualStudio.ReqnrollConnector.Generic/AssemblyLoading/RuntimeCompositeCompilationAssemblyResolver.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ public RuntimeCompositeCompilationAssemblyResolver(ICompilationAssemblyResolver[
1111
_log = log;
1212
}
1313

14-
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
14+
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string>? assemblies)
1515
{
1616
foreach (ICompilationAssemblyResolver resolver in _resolvers)
1717
try
1818
{
1919
if (resolver.TryResolveAssemblyPaths(library, assemblies) &&
20+
assemblies != null &&
2021
assemblies.Any(a => !IsRefsPath(a)))
2122
{
22-
var resolveAssemblyPath = assemblies.FirstOrDefault(a => !IsRefsPath(a));
23+
var resolveAssemblyPath = assemblies.First(a => !IsRefsPath(a));
24+
if ("System.Runtime.dll".Equals(Path.GetFileName(resolveAssemblyPath), StringComparison.OrdinalIgnoreCase))
25+
{
26+
_log.Info($"Skipping {resolveAssemblyPath} ({resolver})");
27+
assemblies.Remove(resolveAssemblyPath);
28+
return false;
29+
}
2330
_log.Info($"Resolved with {resolver} from {resolveAssemblyPath}");
2431
return true;
2532
}

Connectors/SpecFlow.VisualStudio.SpecFlowConnector.Generic/AssemblyLoading/RuntimeCompositeCompilationAssemblyResolver.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ public RuntimeCompositeCompilationAssemblyResolver(ICompilationAssemblyResolver[
1111
_log = log;
1212
}
1313

14-
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
14+
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string>? assemblies)
1515
{
1616
foreach (ICompilationAssemblyResolver resolver in _resolvers)
1717
try
1818
{
1919
if (resolver.TryResolveAssemblyPaths(library, assemblies) &&
20+
assemblies != null &&
2021
assemblies.Any(a => !IsRefsPath(a)))
2122
{
22-
var resolveAssemblyPath = assemblies.FirstOrDefault(a => !IsRefsPath(a));
23+
var resolveAssemblyPath = assemblies.First(a => !IsRefsPath(a));
24+
if ("System.Runtime.dll".Equals(Path.GetFileName(resolveAssemblyPath), StringComparison.OrdinalIgnoreCase))
25+
{
26+
_log.Info($"Skipping {resolveAssemblyPath} ({resolver})");
27+
assemblies.Remove(resolveAssemblyPath);
28+
return false;
29+
}
2330
_log.Info($"Resolved with {resolver} from {resolveAssemblyPath}");
2431
return true;
2532
}

0 commit comments

Comments
 (0)