Closed
Description
After upgrading to xUnit 2.2, every VS test over in http://github.com/dotnet/project-system is failing with:
Message: System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
We use this assembly in our tests, however, the binary lives alongside our tests - and before upgrading to xUnit 2.2 there was no issues loading it.
- This only occurs when the PowerShell tools are installed.
- If I start debugging and break on exceptions, I notice that this assembly initially fails to load while RockSteady is walking the types of file:///C:/PROGRAM%20FILES%20(X86)/MICROSOFT%20VISUAL%20STUDIO/2017/ENTERPRISE/COMMON7/IDE/EXTENSIONS/XSNRCEZZ.I1M/PowerShellTools.TestAdapter.dll. Stack below under Details:
mscorlib.dll!System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName fileName, string codeBase, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly locationHint, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks) Unknown
mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly reqAssembly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks) Unknown
mscorlib.dll!System.Reflection.Assembly.Load(System.Reflection.AssemblyName assemblyRef) Unknown
Microsoft.VisualStudio.TestPlatform.Common.dll!Microsoft.VisualStudio.TestPlatform.Common.RockSteady.TestPluginsFramework.TestPluginCache.CurrentDomain_AssemblyResolve(object sender, System.ResolveEventArgs args) Unknown
mscorlib.dll!System.AppDomain.OnAssemblyResolveEvent(System.Reflection.RuntimeAssembly assembly, string assemblyFullName) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.Reflection.RuntimeModule.GetTypes() Unknown
mscorlib.dll!System.Reflection.Assembly.GetTypes() Unknown
> Microsoft.VisualStudio.TestPlatform.Common.dll!Microsoft.VisualStudio.TestPlatform.Common.RockSteady.TestPluginsFramework.TestPluginDiscoverer.GetTestExtensionsFromAssembly(System.Reflection.Assembly assembly, System.Collections.Generic.Dictionary testDiscoverers, System.Collections.Generic.Dictionary testExecutors, System.Collections.Generic.Dictionary testSettingsProviders, System.Collections.Generic.Dictionary testLoggers) Unknown
Microsoft.VisualStudio.TestPlatform.Common.dll!Microsoft.VisualStudio.TestPlatform.Common.RockSteady.TestPluginsFramework.TestPluginDiscoverer.GetTestExtensionsFromFiles(string[] files, bool loadOnlyWellKnownExtensions, System.Collections.Generic.Dictionary testDiscoverers, System.Collections.Generic.Dictionary testExecutors, System.Collections.Generic.Dictionary testSettingsProviders, System.Collections.Generic.Dictionary testLoggers) Unknown
Microsoft.VisualStudio.TestPlatform.Common.dll!Microsoft.VisualStudio.TestPlatform.Common.RockSteady.TestPluginsFramework.TestPluginDiscoverer.GetTestExtensionsInformation(bool loadOnlyWellKnownExtensions, out System.Collections.Generic.Dictionary testDiscoverers, out System.Collections.Generic.Dictionary testExecutors, out System.Collections.Generic.Dictionary testSettingsProviders, out System.Collections.Generic.Dictionary testLoggers) Unknown
Microsoft.VisualStudio.TestPlatform.Common.dll!Microsoft.VisualStudio.TestPlatform.Common.RockSteady.TestPluginsFramework.TestPluginCache.DiscoverTestExtensions() Unknown
Microsoft.VisualStudio.TestPlatform.Common.dll!Microsoft.VisualStudio.TestPlatform.Common.RockSteady.TestPluginsFramework.TestPluginManager.GetTestExtensions(out System.Collections.Generic.IEnumerable>> unfiltered, out System.Collections.Generic.IEnumerable> filtered) Unknown
Microsoft.VisualStudio.TestPlatform.Common.dll!Microsoft.VisualStudio.TestPlatform.Common.RockSteady.TestDiscoveryExtensionManager.Create() Unknown
Microsoft.VisualStudio.TestPlatform.Core.dll!Microsoft.VisualStudio.TestPlatform.Core.DiscoveryManager.LoadExtensions(bool throwOnError) Unknown
Microsoft.VisualStudio.TestPlatform.Core.dll!Microsoft.VisualStudio.TestPlatform.Core.DiscoveryManager.LoadAndInitialize(bool throwOnError) Unknown
Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll!Microsoft.VisualStudio.TestPlatform.TestExecutor.TestExecutorWebService.InitializeConnection.AnonymousMethod__0(object source) Unknown
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Unknown
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Unknown
- CLR caches assembly failed loads - so I'm guessing whatever resolver is hooked up during the test runners never gets called back because it failed to load initially while trying to find TestExtensions.
- This only occurred after upgrading to 2.2 - does this path only occur the first time Test Explorer sees an extension perhaps? I don't know why it didn't occur with xUnit 2.1.
The code in particular this branch: https://github.com/basoundr/roslyn-project-system/tree/MoveXunit.