Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail with "Could not load file or assembly 'Microsoft.VisualStudio.Shell.Interop" when PowerShell tools are installed and you use Microsoft.VisualStudio.Shell.Interop #692

Closed
davkean opened this issue Apr 6, 2017 · 1 comment
Assignees

Comments

@davkean
Copy link
Member

davkean commented Apr 6, 2017

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.

  1. This only occurs when the PowerShell tools are installed.
  2. 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
  1. 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.
  2. 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.

@codito codito added the exp: ide label Apr 7, 2017
@Faizan2304 Faizan2304 added the bug label Jul 9, 2017
@Faizan2304 Faizan2304 added this to the 15.5 milestone Jul 9, 2017
@Faizan2304 Faizan2304 modified the milestones: 15.5 (Sprint 122), 15.5 Aug 14, 2017
@Faizan2304 Faizan2304 self-assigned this Aug 14, 2017
@Faizan2304
Copy link
Contributor

Duplicate of bug #844
This fix is part of visual studio 2017 update3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants