8000 Visual Studio crashes when I click on Team Explorer · Issue #923 · github/VisualStudio · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Visual Studio crashes when I click on Team Explorer #923

Closed
jcansdale opened this issue Mar 14, 2017 · 6 comments
Closed

Visual Studio crashes when I click on Team Explorer #923

jcansdale opened this issue Mar 14, 2017 · 6 comments
Assignees
Labels

Comments

@jcansdale
Copy link
Collaborator
  • GitHub Extension for Visual Studio version: 2.2.0.8
  • Visual Studio version: 2017 Enterprise
  1. Double-click on .sln file
  2. Visual Studio opens with Solution Explorer window active
  3. Click on 'Team Explorer' tab
  4. Visual Studio crashes

image

The following was sent to debug output:

[38932] <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain><Exception><ExceptionType>System.TypeInitializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.</Message><StackTrace>   at LibGit2Sharp.Core.NativeMethods.RemoveHandle() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()</StackTrace><ExceptionString>System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---&amp;gt; System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[38932]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[38932]    at LibGit2Sharp.Core.NativeMethods..cctor() 
[38932]    --- End of inner exception stack trace --- 
[38932]    at LibGit2Sharp.Core.NativeMethods.RemoveHandle() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()</ExceptionString><DataItems><Data></Data></DataItems><InnerException><ExceptionType>System.DllNotFoundException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</Message><StackTrace>   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[38932]    at LibGit2Sharp.Core.NativeMethods..cctor()</StackTrace><ExceptionString>System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[38932]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[38932]    at LibGit2Sharp.Core.NativeMethods..cctor()</ExceptionString></InnerException></Exception></TraceRecord> 
[38932] System.Transactions Critical: 0 : 
[38932] <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain><Exception><ExceptionType>System.TypeInitializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.</Message><StackTrace>   at LibGit2Sharp.Core.NativeMethods.RemoveHandle() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()</StackTrace><ExceptionString>System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---&amp;gt; System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[38932]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[38932]    at LibGit2Sharp.Core.NativeMethods..cctor() 
[38932]    --- End of inner exception stack trace --- 
[38932]    at LibGit2Sharp.Core.NativeMethods.RemoveHandle() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()</ExceptionString><DataItems><Data></Data></DataItems><InnerException><ExceptionType>System.DllNotFoundException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</Message><StackTrace>   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[38932]    at LibGit2Sharp.Core.NativeMethods..cctor()</StackTrace><ExceptionString>System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[38932]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[38932]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[38932]    at LibGit2Sharp.Core.NativeMethods..cctor()</ExceptionString></InnerException></Exception></TraceRecord> 
@jcansdale jcansdale added the bug label Mar 14, 2017
@jcansdale jcansdale self-assigned this Mar 14, 2017
@jcansdale
Copy link
Collaborator Author
jcansdale commented Mar 14, 2017

Here's some more debug output:

[31672] <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical">
<TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain>
<Exception>
<ExceptionType>System.TypeInitializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.</Message>
<StackTrace>   at LibGit2Sharp.Core.NativeMethods.git_buf_free(GitBuf buf) 
[31672]    at LibGit2Sharp.Core.Handles.GitBuf.Dispose() 
[31672]    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) 
[31672]    at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path) 
[31672]    at LibGit2Sharp.Repository.Discover(String startingPath) 
[31672]    at GitHub.Services.GitService.GetRepository(String path) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.Exports\Services\GitService.cs:line 56 
[31672]    at GitHub.Services.GitService.GetUri(String path, String remote) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.Exports\Services\GitService.cs:line 41 
[31672]    at GitHub.Models.RepositoryModel..ctor(String path) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.Exports\Models\RepositoryModel.cs:line 48 
[31672]    at GitHub.VisualStudio.Base.IGitRepositoryInfoExtensions.ToModel(IGitRepositoryInfo repo) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.TeamFoundation.14\Base\TeamExplorerServiceHolder.cs:line 255 
[31672]    at GitHub.VisualStudio.Base.TeamExplorerServiceHolder.&amp;lt;UIContextChanged&amp;gt;b__20_0() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.TeamFoundation.14\Base\TeamExplorerServiceHolder.cs:line 165 
[31672]    at System.Threading.Tasks.Task`1.InnerInvoke() 
[31672]    at System.Threading.Tasks.Task.Execute() 
[31672] --- End of stack trace from previous location where exception was thrown --- 
[31672]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
[31672]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
[31672]    at GitHub.VisualStudio.Base.TeamExplorerServiceHolder.&amp;lt;UIContextChanged&amp;gt;d__20.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.TeamFoundation.14\Base\TeamExplorerServiceHolder.cs:line 151 
[31672] --- End of stack trace from previous location where exception was thrown --- 
[31672]    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.&amp;lt;&amp;gt;c.&amp;lt;ThrowAsync&amp;gt;b__6_0(Object state) 
[31672]    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
[31672]    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 
[31672]    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
[31672]    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 
[31672]    at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) 
[31672]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
[31672]    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
[31672]    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
[31672]    at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) 
[31672]    at System.Windows.Threading.DispatcherOperation.Invoke() 
[31672]    at System.Windows.Threading.Dispatcher.ProcessQueue() 
[31672]    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled) 
[31672]    at MS.Win32.HwndWrapper.WndPr
[31672] oc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled) 
[31672]    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
[31672]    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
[31672]    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 
[31672]    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 
[31672]    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)</StackTrace><ExceptionString>System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---&amp;gt; System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[31672]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[31672]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[31672]    at LibGit2Sharp.Core.NativeMethods..cctor() 
[31672]    --- End of inner exception stack trace --- 
[31672]    at LibGit2Sharp.Core.NativeMethods.git_buf_free(GitBuf buf) 
[31672]    at LibGit2Sharp.Core.Handles.GitBuf.Dispose() 
[31672]    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) 
[31672]    at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path) 
[31672]    at LibGit2Sharp.Repository.Discover(String startingPath) 
[31672]    at GitHub.Services.GitService.GetRepository(String path) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.Exports\Services\GitService.cs:line 56 
[31672]    at GitHub.Services.GitService.GetUri(String path, String remote) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.Exports\Services\GitService.cs:line 41 
[31672]    at GitHub.Models.RepositoryModel..ctor(String path) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.Exports\Models\RepositoryModel.cs:line 48 
[31672]    at GitHub.VisualStudio.Base.IGitRepositoryInfoExtensions.ToModel(IGitRepositoryInfo repo) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.TeamFoundation.14\Base\TeamExplorerServiceHolder.cs:line 255 
[31672]    at GitHub.VisualStudio.Base.TeamExplorerServiceHolder.&amp;lt;UIContextChanged&amp;gt;b__20_0() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.TeamFoundation.14\Base\TeamExplorerServiceHolder.cs:line 165 
[31672]    at System.Threading.Tasks.Task`1.InnerInvoke() 
[31672]    at System.Threading.Tasks.Task.Execute() 
[31672] --- End of stack trace from previous location where exception was thrown --- 
[31672]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
[31672]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
[31672]    at GitHub.VisualStudio.Base.TeamExplorerServiceHolder.&amp;lt;UIContextChanged&amp;gt;d__20.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.TeamFoundation.14\Base\TeamExplorerServiceHolder.cs:line 151 
[31672] --- End of stack trace from previous location where exception was thrown --- 
[31672]    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.&amp;lt;&amp;gt;c.&amp;lt;ThrowAsync&amp;gt;b__6_0(Object state) 
[31672]    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
[31672]    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 
[31672]    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
[31672]    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 
[31672]    at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) 
[31672]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
[31672]    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callb
[31672] ack, Object state, Boolean preserveSyncCtx) 
[31672]    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
[31672]    at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) 
[31672]    at System.Windows.Threading.DispatcherOperation.Invoke() 
[31672]    at System.Windows.Threading.Dispatcher.ProcessQueue() 
[31672]    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled) 
[31672]    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled) 
[31672]    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
[31672]    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
[31672]    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 
[31672]    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 
[31672]    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)</ExceptionString><DataItems><Data></Data></DataItems><InnerException><ExceptionType>System.DllNotFoundException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</Message><StackTrace>   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[31672]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[31672]    at LibGit2Sharp.Core.NativeMethods..cctor()</StackTrace><ExceptionString>System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[31672]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[31672]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[31672]    at LibGit2Sharp.Core.NativeMethods..cctor()</ExceptionString></InnerException></Exception></TraceRecord> 

@jcansdale
Copy link
Collaborator Author

I hardened the GitService.GetRepository method and ended up with this:

[42776] ================================================= 
[42776] Repository.Discover(C:\Source\proto\GitHub.VisualStudio.Contrib) 
[42776] System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[42776]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[42776]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[42776]    at LibGit2Sharp.Core.NativeMethods..cctor() 
[42776]    --- End of inner exception stack trace --- 
[42776]    at LibGit2Sharp.Core.NativeMethods.git_buf_free(GitBuf buf) 
[42776]    at LibGit2Sharp.Core.Handles.GitBuf.Dispose() 
[42776]    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) 
[42776]    at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path) 
[42776]    at LibGit2Sharp.Repository.Discover(String startingPath) 
[42776]    at GitHub.Services.GitService.GetRepository(String path) in C:\Source\github.com\github\VisualStudio\src\GitHub.Exports\Services\GitService.cs:line 59 
[42776] ================================================= 
[42776] System.Transactions Critical: 0 : 
[42776] <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain><Exception><ExceptionType>System.TypeInitializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.</Message><StackTrace>   at LibGit2Sharp.Core.NativeMethods.RemoveHandle() 
[42776]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()</StackTrace><ExceptionString>System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---&amp;gt; System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[42776]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[42776]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[42776]    at LibGit2Sharp.Core.NativeMethods..cctor() 
[42776]    --- End of inner exception stack trace --- 
[42776]    at LibGit2Sharp.Core.NativeMethods.RemoveHandle() 
[42776]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()</ExceptionString><InnerException><ExceptionType>System.DllNotFoundException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</Message><StackTrace>   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[42776]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[42776]    at LibGit2Sharp.Core.NativeMethods..cctor()</StackTrace><ExceptionString>System.DllNotFoundException: Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
[42776]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() 
[42776]    at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() 
[42776]    at LibGit2Sharp.Core.NativeMethods..cctor()</ExceptionString></InnerException></Exception></TraceRecord> 

@jcansdale
Copy link
Collaborator Author

I believe this is related.
image

It seems LibGit2Sharp.dll and GitHub.Exports.dll are beig copied to:

C:\Users\passp\AppData\Local\Temp\VS\AnalyzerAssemblyLoader

😕

@jcansdale
Copy link
Collaborator Author

It looks like something added the following to one of my projects.

  <ItemGroup>
    <Analyzer Include="..\..\..\..\github.com\github\VisualStudio\build\Debug\GitHub.Exports.dll" />
    <Analyzer Include="..\..\..\..\github.com\github\VisualStudio\build\Debug\LibGit2Sharp.dll" />
  </ItemGroup>

Apparently this means copy these files into a temp directory and stuff them into the Assembly.LoadFrom context. Hu? 😕

@jcansdale
Copy link
Collaborator Author
jcansdale commented Mar 18, 2017

It appears I may have dumb thumbed adding a reference and added an analyzer instead. When I removed the <Analyzer> elements, the situation improved. 😄

Unfortunately this issue returned, with Visual Studio loading assemblies from this location instead:

C:\Users\passp\AppData\Local\Microsoft\VisualStudio\15.0_6fae993f\ProjectAssemblies

It looks like there can be a fight between different assembly resolvers, with whichever resolver gets added first deciding where assemblies get loaded from. 😭

Luckily the assembly resolver that appears to come with Visual Studio is only likely to resolve one of our assemblies, if it's referenced by a project. This is only likely to happen in one of our projects or in a project that is attempting to extend GitHub for Visual Studio.

There are a few mitigations for this:

  1. Specify a CodeBase for assemblies in Visual Studio's .config file (using ProvideCodeBase attributes)
  2. Sweep up all versions of our assemblies using a ProvideBindingRedirection attribute.
  3. Ensure that assemblies without an explicit CodeBase never need to be referenced directly (use an interface assembly instead)

Summary

The root cause of this issue is one of our assemblies getting loaded into the wrong codebase.

jcansdale added a commit that referenced this issue Apr 26, 2017
Added a workaround related to #923 that gives our resolver a chance to run first.
Be more specific about which assemblies might be resolved (include PublicKeyToken).
They must start with "Microsoft.TeamFoundation." and end with ", PublicKeyToken=b03f5f7f11d50a3a".
@jcansdale
Copy link
Collaborator Author

This was particularly an issue when the GitHubVS.sln was opened directly (rather than loading GitHubVS.sln from inside Visual Studio).

It should no longer be a problem now that #914 has been merged.

jcansdale added a commit that referenced this issue May 2, 2017
Added a workaround related to #923 that gives our resolver a chance to run first.
Be more specific about which assemblies might be resolved (include PublicKeyToken).
They must start with "Microsoft.TeamFoundation." and end with ", PublicKeyToken=b03f5f7f11d50a3a".
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant
0