MBulli / SmartCommandlineArgs

A Visual Studio Extension which aims to provide a better UI to manage your command line arguments
GNU General Public License v2.0
99 stars 35 forks source link

SetSite failed for package [CmdArgsPackage] #163

Closed mauriziodepascale closed 6 months ago

mauriziodepascale commented 11 months ago

Hi, I've been using the extension successfully for many weeks. Then it started failing to load (same exact codebase). After a bit the same issue showed up on a second machine (same codebase) and a third one (idem), so it doesn't seem to be machine-specific, and either codebase-triggered or a bug in the extension. I tried clearing some of the .vs caches and similar folders, but the problem persists.

Here are the last two entries from the ActivyLog.xml:

`

361
<time>2023/11/28 08:14:42.113</time>
<type>Information</type>
<source>SmartCommandlineArgs</source>
<description>[1] Gathering commands from configurations for project &apos;app.engine&apos;.</description>

362 Error VisualStudio SetSite failed for package [CmdArgsPackage]Source: 'Anonymously Hosted DynamicMethods Assembly' Description: The best overloaded method match for 'System.Collections.Generic.List<SmartCmdArgs.Logic.CmdArgumentJson>.Add(SmartCmdArgs.Logic.CmdArgumentJson)' has some invalid arguments {131B0C0A-5DD0-4680-B261-86AB5387B86E}
0x80131500
` ![image](https://github.com/MBulli/SmartCommandlineArgs/assets/11369769/bb857018-bdd8-411e-ac06-7d51ef361447) it would be great if you could look into it - happy to help with reproing. Thanks, Maurizio
Irame commented 8 months ago

Hi, thanks for using the extension and writing this issue. I haven't had time to maintain this extension recently, sorry. I did some rather big project restructuring and added a few features in the latest beta build. Could please try preview version 2.6.0.3 and check if your issue still persists?

Marc-IV commented 7 months ago

I get the same error message using Microsoft Visual Studio Professional 2022, Version 17.8.7. Preview version 2.6.0.3 shows the same behavior. The problem seems to be not present in version 2.6.0.

Here are the recordings in the ActivityLog.xml that come up when I use version 2.6.0.3. `

2046 Information VisualStudio Begin package load [CmdArgsPackage] {131B0C0A-5DD0-4680-B261-86AB5387B86E} 2047 Information VisualStudio Entering function LoadDTETypeLib 2048 Information VisualStudio Leaving function LoadDTETypeLib 2049 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2050 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2051 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2052 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2053 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2054 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2055 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2056 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2057 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2058 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2059 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2060 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2061 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2062 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2063 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2064 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2065 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2066 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2067 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2068 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2069 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2070 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2071 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2072 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2073 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2074 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2075 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2076 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2077 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2078 Warning SmartCommandlineArgs [1] Could not retrieve property with id=-2120 from hierarchy 2079 Error VisualStudio SetSite failed for package [CmdArgsPackage]Source: 'Microsoft.VisualStudio.Shell.Framework' Description: GetDialogPage must be called on the UI thread. System.Runtime.InteropServices.COMException (0x8001010E): GetDialogPage must be called on the UI thread. at Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(String callerMemberName) at SmartCmdArgs.CmdArgsPackage.GetDialogPage[Page]() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at SmartCmdArgs.Services.OptionsSettingsService.InitializeAsync() at SmartCmdArgs.CmdArgsPackage.<InitializeAsyncServices>d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at SmartCmdArgs.CmdArgsPackage.<InitializeAsync>d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass21_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.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) {131B0C0A-5DD0-4680-B261-86AB5387B86E}
0x8001010e

`

kim2048 commented 7 months ago

Hello, same here with VS Professional 2022 17.9.5 😢

Irame commented 7 months ago

Unfortunately I can't reproduce the issue, but I tried to fix it anyway. Could you please try v3.0.1 and give me feedback if the issue is solved or not, thanks!

Marc-IV commented 6 months ago

It still does not work with v3.0.1.

<entry>
    <record>464</record>
    <time>2024/04/03 07:05:06.505</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [CmdArgsPackage]</description>
    <guid>{131B0C0A-5DD0-4680-B261-86AB5387B86E}</guid>
  </entry>
  <entry>
    <record>465</record>
    <time>2024/04/03 07:05:06.568</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [CmdArgsPackage]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.Runtime.InteropServices.COMException: GetDialogPage must be called on the UI thread.&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(String callerMemberName)&#x000D;&#x000A;   at SmartCmdArgs.CmdArgsPackage.GetDialogPage[Page]()&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)&#x000D;&#x000A;   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)&#x000D;&#x000A;   at SmartCmdArgs.CmdArgsPackage..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.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.Runtime.InteropServices.COMException (0x8001010E): GetDialogPage must be called on the UI thread.&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(String callerMemberName)&#x000D;&#x000A;   at SmartCmdArgs.CmdArgsPackage.GetDialogPage[Page]()&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)&#x000D;&#x000A;   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)&#x000D;&#x000A;   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)&#x000D;&#x000A;   at SmartCmdArgs.CmdArgsPackage..ctor()</description>
    <guid>{131B0C0A-5DD0-4680-B261-86AB5387B86E}</guid>
    <hr>0x80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>
Irame commented 6 months ago

Its a bummer that I can't reproduce the issue and have to do fixes that should fix the problem instead of fixes that actually fix the problem... Here is another try: v3.0.2

Irame commented 6 months ago

Im tagging this as a duplicate, please continue the conversation in issue #177.