为什么我在将 VS 2019 扩展移植到 VS 2022 时遇到灾难性失败错误?

问题描述 投票:0回答:1

我正在将扩展从 Visual Studio 2019 版本移植到 2022。

此扩展创建一个新的工具窗口。安装后,扩展在 Visual Studio 的第一个实例中工作正常,然后在工具窗口中给出以下异常。

只有当我从 C:\Users\username\AppData\Local\Microsoft\VisualStudio 中删除本地数据 Visual Studio 17* 目录时,它才会再次工作,但仅一次。

Exception details:
System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.Shell.Package.CreateFrameForToolWindow(ToolWindowCreationResult result, Int32 id, Guid persistenceGuid)
   at Microsoft.VisualStudio.Shell.Package.<>c__DisplayClass84_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.CreateToolWindow(Type toolWindowType, Int32 id, Object context)
   at Microsoft.VisualStudio.Shell.Package.<>c__DisplayClass94_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__DisplayClass94_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__DisplayClass13_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.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|145_1(WindowFrame frame)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()

使用的版本: Microsoft Visual Studio Professional 2022(64 位)-LTSC 17.4 - 版本 17.4.4

我确实将 dll 引用从旧版本更改为新版本 (17.*) 例如:从 Microsoft.VisualStudio.Shell.dll 更改为 Microsoft.VisualStudio.Shell.15.0.dll

请帮忙。我可以分享更多细节。

c# visual-studio-2022 visual-studio-extensions
1个回答
0
投票

我也遇到了完全相同的问题。 我的扩展创建了一个新的工具窗口。安装后,扩展在 Visual Studio 的第一个实例中正常工作然后它在工具窗口中给出以下异常。清除 %AppData% 中的 privateregistry.bin 文件可以解决问题,但不能在每次启动后执行此操作。 我的所有项目引用都指向同一版本的 Microsoft.VisualStudio.Shell.15.0.dll (17.6.36389) 您或任何人有同样的解决方案吗?

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.