aws / aws-toolkit-visual-studio

AWS Toolkit for Visual Studio - a plugin to interact with AWS
https://aws.amazon.com/visualstudio/
Apache License 2.0
110 stars 29 forks source link

Exception on VS Startup: AWSNavigatorToolControl' does not have a resource identified by the URI '/AWSToolkitPackage.v17;component/toolwindow/awsnavigatortoolcontrol.xaml'. #385

Closed ppittle closed 9 months ago

ppittle commented 9 months ago

Describe the bug When I open the AWS Explorer panel, there is the follow exception message:

An exception was encountered while constructing the content of this frame. 

Exception details:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: The component 'Amazon.AWSToolkit.VisualStudio.ToolWindow.AWSNavigatorToolControl' does not have a resource identified by the URI '/AWSToolkitPackage.v17;component/toolwindow/awsnavigatortoolcontrol.xaml'.
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at Amazon.AWSToolkit.VisualStudio.ToolWindow.AWSNavigatorToolControl..ctor()
   at Amazon.AWSToolkit.VisualStudio.ToolWindow.AWSNavigatorToolWindow..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.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.VisualStudio.Shell.Package.InstantiateToolWindow(Type toolWindowType, Object context)
   at Microsoft.VisualStudio.Shell.Package.<>c__DisplayClass87_0.<CreateToolWindow>g__CreateToolWindowWorker|1()
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, UInt32 flags, Object context, Guid persistenceGuid)
   at Microsoft.VisualStudio.Shell.Package.<>c__DisplayClass97_1.<<FindToolWindow>b__1>d.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.Package.<>c__DisplayClass97_0.<<FindToolWindow>b__0>d.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.ToolWindowCollection.ToolWindowListener.<>c__DisplayClass1_0.<<-ctor>b__0>d.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.Threading.AwaitExtensions.ExecuteContinuationSynchronouslyAwaiter`1.GetResult()
   at Microsoft.VisualStudio.Threading.AsyncLazy`1.<>c__DisplayClass16_0.<<GetValueAsync>b__0>d.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.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.AsyncLazy`1.GetValue(CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute tool)
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Guid& toolWindowType, Int32 id)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.<ConstructContent>g__ConstructContentFromPackage|225_1(WindowFrame frame)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()

To Reproduce

  1. Open Visual Studio
  2. Open AWS Explorer panel

Expected behavior

The AWS Explorer panel is populated with my AWS resources

Screenshots

Toolkit Logs

If applicable, attach toolkit logs by navigating to Extensions / AWS Toolkit / View Toolkit Logs.

I don't see a View Toolkit Logs menu option.

image

Development System (please complete the following information):

Additional context

ppittle commented 9 months ago

Might be a Visual Studio bug?

I disabled the AWS Toolkit plugin and restarted Visual Studio ... and now it loads fine ¯_(ツ)_/¯

image

awschristou commented 9 months ago

Please look for an appropriate log file in the %localappdata%\AWSToolkit\logs folder.

Can you check your list of installed extensions again. Do you also happen to have one called "AWSToolkitDev" installed?

ppittle commented 9 months ago

Can you check your list of installed extensions again. Do you also happen to have one called "AWSToolkitDev" installed?

No Dev plugin: image

Please look for an appropriate log file Not sure what exactly I'm looking for, but there's a few exceptions in here:

2023-12-11 20:02:38,496 [57] ERROR Amazon.AWSToolkit.VisualStudio.ToolkitThemeProvider - System.Windows.Markup.XamlParseException: Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception. ---> System.Xaml.XamlObjectWriterException: Provide value on 'MS.Internal.Markup.StaticExtension' threw an exception. ---> System.ArgumentException: 'Amazon.AWSToolkit.Themes.ToolkitThemeResourceKeys.ListBoxStyle' StaticExtension value cannot be resolved to an enumeration, static field, or static property.
   at System.Windows.Markup.StaticExtension.ProvideValue(IServiceProvider serviceProvider)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
   --- End of inner exception stack trace ---
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
   at System.Xaml.XamlObjectWriter.Logic_ProvideValue(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteEndObject()
   at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at System.Windows.ResourceDictionary.EvaluateMarkupExtensionNodeList(XamlReader reader, IServiceProvider serviceProvider)
   at System.Windows.ResourceDictionary.GetKeyValue(KeyRecord key, IServiceProvider serviceProvider)
   at System.Windows.ResourceDictionary.SetKeys(IList`1 keyCollection, IServiceProvider serviceProvider)
   at System.Windows.Baml2006.WpfSharedBamlSchemaContext.<>c.<Create_BamlProperty_ResourceDictionary_DeferrableContent>b__299_0(Object target, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
   --- End of inner exception stack trace ---
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
   at MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverterCore(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter, Boolean isUnsafe)
   at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStreamCore(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter, Boolean isUnsafe)
   at System.Windows.ResourceDictionary.set_Source(Uri value)
   at Amazon.AWSToolkit.VisualStudio.ToolkitThemeProvider.LoadResourceDictionary(String uriString)
2023-12-11 20:02:38,528 [57] ERROR Amazon.AWSToolkit.VisualStudio.ToolkitThemeProvider - System.Windows.Markup.XamlParseException: Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception. ---> System.Xaml.XamlObjectWriterException: Provide value on 'MS.Internal.Markup.StaticExtension' threw an exception. ---> System.ArgumentException: 'Amazon.AWSToolkit.Themes.ToolkitThemeResourceKeys.ListBoxStyle' StaticExtension value cannot be resolved to an enumeration, static field, or static property.
   at System.Windows.Markup.StaticExtension.ProvideValue(IServiceProvider serviceProvider)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
   --- End of inner exception stack trace ---
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
   at System.Xaml.XamlObjectWriter.Logic_ProvideValue(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteEndObject()
   at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at System.Windows.ResourceDictionary.EvaluateMarkupExtensionNodeList(XamlReader reader, IServiceProvider serviceProvider)
   at System.Windows.ResourceDictionary.GetKeyValue(KeyRecord key, IServiceProvider serviceProvider)
   at System.Windows.ResourceDictionary.SetKeys(IList`1 keyCollection, IServiceProvider serviceProvider)
   at System.Windows.Baml2006.WpfSharedBamlSchemaContext.<>c.<Create_BamlProperty_ResourceDictionary_DeferrableContent>b__299_0(Object target, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
   --- End of inner exception stack trace ---
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
   at MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverterCore(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter, Boolean isUnsafe)
   at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStreamCore(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter, Boolean isUnsafe)
   at System.Windows.ResourceDictionary.set_Source(Uri value)
   at Amazon.AWSToolkit.VisualStudio.ToolkitThemeProvider.LoadResourceDictionary(String uriString)
2023-12-11 20:02:38,628 [59] DEBUG Amazon.AWSToolkit.Telemetry.TelemetryService - Telemetry service disabled
2023-12-11 20:02:38,637 [59] INFO  Amazon.AWSToolkit.ResourceFetchers.FileResourceFetcher - Loading resource: C:\Users\pittle\AppData\Local/AWSToolkit\downloadedfiles\endpoints.json
2023-12-11 20:02:38,692 [15] DEBUG Amazon.AWSToolkit.VisualStudio.Telemetry.TelemetryManager - Initializing Telemetry Service
2023-12-11 20:02:38,750 [59] DEBUG Amazon.AWSToolkit.Regions.RegionProvider - Updating AWS SDK with endpoints data...
2023-12-11 20:02:38,843 [59] DEBUG Amazon.AWSToolkit.Regions.RegionProvider - Finished updating AWS SDK with endpoints data
2024-01-23 20:30:51,282 [1] INFO  Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterEventListener - Error handling Debug Context Change
System.NullReferenceException: Object reference not set to an instance of an object.
   at Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterEventListener.OnDebuggerContextChanged(Process newProcess, Program newProgram, Thread newThread, StackFrame newStackFrame)
2024-01-23 20:30:51,330 [1] INFO  Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterEventListener - Error handling Debug Context Change
System.NullReferenceException: Object reference not set to an instance of an object.
   at Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterEventListener.OnDebuggerContextChanged(Process newProcess, Program newProgram, Thread newThread, StackFrame newStackFrame)
2024-01-23 20:54:36,237 [1] INFO  Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterEventListener - Error handling Debug Context Change
System.NullReferenceException: Object reference not set to an instance of an object.
   at Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterEventListener.OnDebuggerContextChanged(Process newProcess, Program newProgram, Thread newThread, StackFrame newStackFrame)
2024-01-23 20:54:36,255 [1] INFO  Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterEventListener - Error handling Debug Context Change
System.NullReferenceException: Object reference not set to an instance of an object.
floralph commented 9 months ago

It sounds like you can no longer repro the issue after disabling then re-enabling the toolkit extension or are you able to repro it now?

Did you notice the issue across multiple Visual Studio sessions or did it only occur during a single session?

Did the issue occur immediately upon installation of that version of the toolkit or did it run as expected prior to the issue occurring?

The first log you posted seems to indicate an issue with XAML processing similar to the stack trace from the original post, but it's not clear if it is related. The latter log doesn't appear to be related, not directly at least.

The odd thing is the missing URI is in the main assembly and the extension wouldn't start without that assembly, so it doesn't appear to be a missing assembly issue. I wouldn't think VS would attempt to reinstall assemblies when enabling an extension either.

ppittle commented 9 months ago

It sounds like you can no longer repro

That is correct.

After several reboots, VS still shows AWS Toolkit as [Disabled] but the AWS Explorer window loads just fine. Seems my Visual Studio is in a funky state?

I doubt it will make sense to explore further - I have no idea how I got Visual Studio to behave this way, so little chance of reproducing the issue. Thanks for checking though!