madskristensen / Tweakster

A Visual Studio extension
Apache License 2.0
238 stars 23 forks source link

System.MissingMethodException: Methode nicht gefunden: "Void Community.VisualStudio.Toolkit.BaseCommand`1..ctor()" #76

Closed MagicAndre1981 closed 3 years ago

MagicAndre1981 commented 3 years ago

Last week I had to repair my VS2019 to fix some issues, now I reinstalled some extension from what I thought I had installed and now I get an error with your extension:

SetSite failed for package [TweaksterPackage]Source: 'mscorlib' Description: Exception has been thrown by the target of an invocation. 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Methode nicht gefunden: "Void Community.VisualStudio.Toolkit.BaseCommand`1..ctor()". 
at Tweakster.ResetZoomLevel..ctor() --- End of inner exception stack trace --- 
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) 
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) 
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) 
at System.Activator.CreateInstance[T]() at Community.VisualStudio.Toolkit.BaseCommand`1.<InitializeAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
at Tweakster.TweaksterPackage.<InitializeAsync>d__0.MoveNext() in C:\projects\tweakster\src\TweaksterPackage.cs:line 33 --- End of stack trace from previous location where exception was thrown --- 
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass20_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__70.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) 
at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) 
at Microsoft.VisualStudio.Services.VsTask.GetResult()System.MissingMethodException: Methode nicht gefunden: "Void Community.VisualStudio.Toolkit.BaseCommand`1..ctor()". at Tweakster.ResetZoomLevel..ctor()
MagicAndre1981 commented 3 years ago

Ok, I can see that I have 3 different file versions of Community.VisualStudio.Toolkit.dll used by 3 different extensions.

community vstoolkit

1 is from your KnownMonikers Explorer (.71), 1 from Tweakster (.75.25) and 1 from Extensibility Logs (.75.5) made by @yannduran .

Welcome to DLL hell

MagicAndre1981 commented 3 years ago

ok, the linked issue is marked as closed. Can you please release a new version so that I can test it?

madskristensen commented 3 years ago

We found a bug in VS on how it registers dependent assemblies. We got around it in the latest Toolkit package, which now both Tweaks and KnownMonikers Explorer uses. I've uploaded the new versions to the Marketplace

MagicAndre1981 commented 3 years ago

We found a bug in VS on how it registers dependent assemblies. We got around it in the latest Toolkit package, which now both Tweaks and KnownMonikers Explorer uses.

thanks the new version work fine. Can you please share some details about it?

I run into the issue with 2 extension from @yannduran . His Extensibility logs and StartPage+ extension use a DLL with code extension methods and the DLL is provided in 2 versions and causes System.TypeLoadException because the older DLL misses the new code.

madskristensen commented 3 years ago

If a library doesn't have a strongname, then VS is not registering it correctly as a dependent assembly. The fix was to add a strongname to the Tookit assembly.