AmpScm / AnkhSVN

AnkhSVN provides first class Subversion support for all recent Visual Studio versions.
Apache License 2.0
142 stars 37 forks source link

Extension crashes on start of Visual Studio 2017 #6

Closed DrMaester closed 3 years ago

DrMaester commented 3 years ago

Extension suddenly cannot be loaded. My Visual Studio Version: 15.9.36 Extension Version: 2.9.37 Extracted from ActivityLog.xml:

169 Information VisualStudio Begin package load [AnkhSVN - Subversion Support for Visual Studio] {604AD610-5CF9-4BD5-8ACC-F49810E2EFD4} 170 Error VisualStudio CreateInstance failed for package [AnkhSVN - Subversion Support for Visual Studio]Source: 'mscorlib' Description: Die Datei oder Assembly "Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden. System.IO.FileNotFoundException: Die Datei oder Assembly "Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden. Dateiname: "Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" bei System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) bei System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) bei System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) bei System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName) WRN: Protokollierung der Assemblybindung ist AUS. Sie können die Protokollierung der Assemblybindungsfehler aktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) auf 1 festlegen. Hinweis: Die Protokollierung der Assemblybindungsfehler führt zu einer gewissen Leistungseinbuße. Sie können dieses Feature deaktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] entfernen. {604AD610-5CF9-4BD5-8ACC-F49810E2EFD4}
80004005 - E_FAIL
jadonclegg commented 3 years ago

We're also getting this issue on the latest version of AnkhSVN, but older versions work fine.

AndreaTalentum commented 3 years ago

Same error for me... How can i install previous version? thank you

jadonclegg commented 3 years ago

You can try downloading it here https://ankhsvn.open.collab.net/daily/2.7.x

rhuijben commented 3 years ago

Do you have VS 2019 installed as well? Trying to track down the root cause. We just switched to a new buildsystem and are trying to get things up and running again in this Open source project.

jadonclegg commented 3 years ago

We're using Visual Studio Professional 2017 - Version 15.9.36

AndreaTalentum commented 3 years ago

You can try downloading it here https://ankhsvn.open.collab.net/daily/2.7.x

Thank you for reply, but i need .vsix extension to install in visual studio... I can't install with .msi file... Can you help me?

jadonclegg commented 3 years ago

You can try downloading it here https://ankhsvn.open.collab.net/daily/2.7.x

Thank you for reply, but i need .vsix extension to install in visual studio... I can't install with .msi file... Can you help me?

We're trying to figure out how to downgrade as well, that msi file didn't work for us either. We just have multiple people running the extension and all the one's that haven't updated work fine.

kuenzign commented 3 years ago

Same issue here. I have VS 2005, VS 2010, and VS 2017 installed (no VS 2019). The crash only appears to happen in VS 2017. As @AndreaTalentum states, the supplied link to the .msi does not install the extension to VS 2017.

jadonclegg commented 3 years ago

Here's the error we're getting (in English)

It looks like a specific file / dependency is missing.

CreateInstance failed for package [AnkhSVN - Subversion Support for Visual Studio]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

rhuijben commented 3 years ago

Visual Studio 2017 and 2019 need a .vsix file. The .msi files work only for older versions. We just released a first official version for 2017 and 2019, but it appears the 2017 support is broken.

Help debugging would be welcome. (Just open the .sln from GitHub with either git or via GitHub's subversion support on https://github.com/AmpScm/AnkhSVN/trunk )

I'm trying to setup a VM to diagnose this further myself, but may take a bit.

jadonclegg commented 3 years ago

Tried opening the solution in VS2017, it won't build for me. I've never worked on Extensions for VS so I have no idea what I'm doing. Lots of *** is not compatible with net46 errors.

kuenzign commented 3 years ago

@rhuijben I tried the latest 2.9.48 build from here https://github.com/AmpScm/AnkhSVN/actions/runs/850508145, but it still did not work. Here's the error:

CreateInstance failed for package [AnkhSVN - Subversion Support for Visual Studio]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

jadonclegg commented 3 years ago

@rhuijben Changing this line from v4.6 to v4.7.2 fixed the compile errors, and the extension no longer crashes upon launching VS, but hitting 'update' from the pending changes window makes an error window in VS pop up, which says this:

System.InvalidOperationException: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService. at Microsoft.VisualStudio.Shell.AsyncPackage.GetService(Type serviceType) at Microsoft.VisualStudio.Shell.Package.System.IServiceProvider.GetService(Type serviceType) at Ankh.AnkhRuntime.GetService[T](Type type) at Ankh.AnkhRuntime.GetService[T]() at Ankh.AnkhService.GetService[T]() at Ankh.Commands.SolutionUpdateCommand.PerformUpdate(CommandEventArgs e, ProgressWorkerArgs wa, SvnRevision rev, Boolean allowUnversionedObstructions, Boolean updateExternals, Boolean setDepthInfinity, IEnumerable`1 groups, SvnUpdateResult& updateResult) at Ankh.Commands.SolutionUpdateCommand.<>c__DisplayClass6_1.b__0(Object sender, ProgressWorkerArgs a) at Ankh.ProgressRunnerService.ProgressRunner.Run(Object arg)

tadkison commented 3 years ago

Any chance of downgrading? this is a huge pain?

rhuijben commented 3 years ago

I have an update ready. As I think it resolves the issue while having minimal impact for VS2019 users I'm going to publish it now.

Can you please reply with your results? Thanks for your help!

rhuijben commented 3 years ago

The updated version is AnkhSVN 2.9.50 and should be live on the update site now.

rhuijben commented 3 years ago

Any chance of downgrading? this is a huge pain?

The VS site doesn't support a proper downgrade and the reason we didn't deliver VS2019 support earlier was that our build system didn't support providing stable releases for these versions.

All the scripting is in this public GitHub repository now... so I'm verry sorry that this happened, but once we get this fixed all the development can be done publicly right here... and everybody can help (or just pick old versions from the actions tab if they need them)

jadonclegg commented 3 years ago

Does not crash on loading, but as before when I got it to compile successfully, hitting 'update' from pending changes gives this error:

System.InvalidOperationException: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService. at Microsoft.VisualStudio.Shell.AsyncPackage.GetService(Type serviceType) at Microsoft.VisualStudio.Shell.Package.System.IServiceProvider.GetService(Type serviceType) at Ankh.AnkhRuntime.GetService[T](Type type) at Ankh.AnkhRuntime.GetService[T]() at Ankh.AnkhService.GetService[T]() at Ankh.Commands.SolutionUpdateCommand.PerformUpdate(CommandEventArgs e, ProgressWorkerArgs wa, SvnRevision rev, Boolean allowUnversionedObstructions, Boolean updateExternals, Boolean setDepthInfinity, IEnumerable`1 groups, SvnUpdateResult& updateResult) at Ankh.Commands.SolutionUpdateCommand.<>c__DisplayClass6_0.b__0(Object sender, ProgressWorkerArgs a) at Ankh.ProgressRunnerService.ProgressRunner.Run(Object arg)

greg-galbraith commented 3 years ago

I have an update ready. As I think it resolves the issue while having minimal impact for VS2019 users I'm going to publish it now.

Can you please reply with your results? Thanks for your help!

Still having issue with the update. Receive an error upon opening VS (not opening a solution). VS 2017 (15.9.21) image What is probably the important bit of the ActivityLog.xml generated by the error:

<entry>
    <record>656</record>
    <time>2021/05/17 20:11:08.707</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [AnkhSVN - Subversion Support for Visual Studio]Source: &apos;mscorlib&apos; Description: Exception has been thrown by the target of an invocation.&#x000D;&#x000A;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.InvalidOperationException: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService.&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.AsyncPackage.GetService(Type serviceType)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.System.IServiceProvider.GetService(Type serviceType)&#x000D;&#x000A;   at Ankh.AnkhRuntime.GetService[T](Type type)&#x000D;&#x000A;   at Ankh.AnkhRuntime.GetService[T]()&#x000D;&#x000A;   at Ankh.AnkhRuntime..ctor(IServiceContainer parentContainer)&#x000D;&#x000A;   at Ankh.VSPackage.AnkhSvnPackage..ctor()&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck)&#x000D;&#x000A;   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)&#x000D;&#x000A;   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)&#x000D;&#x000A;   at System.Activator.CreateInstance(Type type, Boolean nonPublic)&#x000D;&#x000A;   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark&amp; stackMark)&#x000D;&#x000A;   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)System.InvalidOperationException: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService.&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.AsyncPackage.GetService(Type serviceType)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.System.IServiceProvider.GetService(Type serviceType)&#x000D;&#x000A;   at Ankh.AnkhRuntime.GetService[T](Type type)&#x000D;&#x000A;   at Ankh.AnkhRuntime.GetService[T]()&#x000D;&#x000A;   at Ankh.AnkhRuntime..ctor(IServiceContainer parentContainer)&#x000D;&#x000A;   at Ankh.VSPackage.AnkhSvnPackage..ctor()</description>
    <guid>{604AD610-5CF9-4BD5-8ACC-F49810E2EFD4}</guid>
    <hr>80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>
Michel4OpenOpcUa commented 3 years ago

Hello, i tried your update but the problem remain. I tried older version from the Action Tab nothing change the crash continue.

davidperez008 commented 3 years ago

Greetings! I have the same issue on VS2017 even with the version 2.9.50 The problem raises when hitting update button. When history button is hit then nothing is showed image

Please help.

jadonclegg commented 3 years ago

I successfully built and installed an older version of the package, and it is working.

To prevent it from automatically updating, you need to make sure to uncheck this option BEFORE installing the old version, or else it will automatically update it the first time you launch VS after installing it. (Uncheck the 'Automatically Update Extensions' checkbox) VS Settings

Here's the file. Hope it works for everyone until the latest version gets compatibility with VS 2017

Ankh.VS15Package.zip

rhuijben commented 3 years ago

A .51 package is posted with fixes for the Update command and the new initialization problem explicitly reported against the new version (but which I'm unable to reproduce).

A few newer packages are available via the Actions page here with cases that might help in less common commands.

Michel4OpenOpcUa commented 3 years ago

Hello, good news. The package .51 available in the action tab fix the issue here. Thank you

rhuijben commented 3 years ago

Thanks for confirming. Waiting for a few others to confirm as well before closing this issue. Please feel free to open new issues if you find them.

DrMaester commented 3 years ago

It seems to be working now. Thanks.