Skip to content

Commit 8d5801b

Browse files
committed
Special handling for InvalidOperationException during discovery
1 parent 6527edf commit 8d5801b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

xunit.runner.visualstudio.testadapter/VsTestRunner.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void DiscoverTests<TVisitor>(IEnumerable<string> sources,
186186

187187
using (var visitor = visitorFactory(assemblyFileName, framework, discoveryOptions))
188188
{
189-
reporterMessageHandler.OnMessage(new TestAssemblyDiscoveryStarting(assembly, AppDomain != AppDomainSupport.Denied, shadowCopy, discoveryOptions));
189+
reporterMessageHandler.OnMessage(new TestAssemblyDiscoveryStarting(assembly, framework.CanUseAppDomains && AppDomain != AppDomainSupport.Denied, shadowCopy, discoveryOptions));
190190

191191
framework.Find(includeSourceInformation: true, messageSink: visitor, discoveryOptions: discoveryOptions);
192192
var totalTests = visitor.Finish();
@@ -207,7 +207,9 @@ void DiscoverTests<TVisitor>(IEnumerable<string> sources,
207207
#if !PLATFORM_DOTNET
208208
var fileLoad = ex as FileLoadException;
209209
#endif
210-
if (fileNotFound != null)
210+
if (ex is InvalidOperationException)
211+
logger.LogWarning("Skipping: {0} ({1})", fileName, ex.Message);
212+
else if (fileNotFound != null)
211213
logger.LogWarning("Skipping: {0} (could not find dependent assembly '{1}')", fileName, Path.GetFileNameWithoutExtension(fileNotFound.FileName));
212214
#if !PLATFORM_DOTNET
213215
else if (fileLoad != null)

0 commit comments

Comments
 (0)