You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS 2022(17.10.0)打开解决方案时崩溃问题求助

VS 2022打开解决方案时崩溃的解决方法

问题现象

VS 2022空启动进入“最近项目”界面一切正常,但打开解决方案文件或选择“无代码继续”时,程序立即冻结并崩溃。事件查看器记录的异常信息如下:

应用程序: devenv.exe
框架版本: v4.0.30319
描述: 进程因未处理的异常而终止。
异常信息: System.Collections.Generic.KeyNotFoundException
   在 System.Windows.Baml2006.Baml2006SchemaContext.GetDependencyProperty(Int16)
   在 System.Windows.Baml2006.Baml2006Reader.Process_PropertyWithExtension()
   在 System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
   在 System.Windows.Baml2006.Baml2006Reader.ReadObject(System.Windows.Baml2006.KeyRecord)
   在 System.Windows.ResourceDictionary.CreateObject(System.Windows.Baml2006.KeyRecord)
   在 System.Windows.ResourceDictionary.OnGettingValue(System.Object, System.Object ByRef, Boolean ByRef)
   在 System.Windows.ResourceDictionary.OnGettingValuePrivate(System.Object, System.Object ByRef, Boolean ByRef)
   在 System.Windows.ResourceDictionary.GetValueWithoutLock(System.Object, Boolean ByRef)
   在 System.Windows.ResourceDictionary.GetValue(System.Object, Boolean ByRef)
   在 System.Windows.ResourceDictionary.GetValueWithoutLock(System.Object, Boolean ByRef)
   在 System.Windows.ResourceDictionary.GetValue(System.Object, Boolean ByRef)
   在 System.Windows.SystemResources.LookupResourceInDictionary(System.Windows.ResourceDictionary, System.Object, Boolean, Boolean, Boolean ByRef)
   在 System.Windows.SystemResources.FindDictionaryResource(System.Object, System.Type, System.Windows.ResourceKey, Boolean, Boolean, Boolean, Boolean ByRef)
   在 System.Windows.SystemResources.FindResourceInternal(System.Object, Boolean, Boolean)
   在 System.Windows.StyleHelper.GetThemeStyle(System.Windows.FrameworkElement, System.Windows.FrameworkContentElement)
   在 System.Windows.FrameworkElement.UpdateThemeStyleProperty()
   在 System.Windows.FrameworkElement.OnInitialized(System.EventArgs)
   在 System.Windows.FrameworkElement.TryFireInitialized()
   在 System.Windows.FrameworkElement.OnVisualParentChanged(System.Windows.DependencyObject)
   在 System.Windows.Media.Visual.FireOnVisualParentChanged(System.Windows.DependencyObject)
   在 System.Windows.Media.Visual.AddVisualChild(System.Windows.Media.Visual)
   在 System.Windows.FrameworkElement.set_TemplateChild(System.Windows.UIElement)
   在 System.Windows.Controls.ContentPresenter+UseContentTemplate.BuildVisualTree(System.Windows.FrameworkElement)
   在 System.Windows.StyleHelper.ApplyTemplateContent(System.Windows.UncommonField`1<System.Collections.Specialized.HybridDictionary[]>, System.Windows.DependencyObject, System.Windows.FrameworkElementFactory, Int32, System.Collections.Specialized.HybridDictionary, System.Windows.FrameworkTemplate)
   在 System.Windows.FrameworkTemplate.ApplyTemplateContent(System.Windows.UncommonField`1<System.Collections.Specialized.HybridDictionary[]>, System.Windows.FrameworkElement)
   在 System.Windows.FrameworkElement.ApplyTemplate()
   在 System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   在 System.Windows.UIElement.Measure(System.Windows.Size)
   在 System.Windows.ContextLayoutManager.UpdateLayout()
   在 System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)
   在 System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   在 System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)
   在 System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   在 System.Windows.Threading.DispatcherOperation.InvokeImpl()
   在 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
   在 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   在 MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   在 System.Windows.Threading.DispatcherOperation.Invoke()
   在 System.Windows.Threading.Dispatcher.ProcessQueue()
   在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   在 MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

针对性解决步骤

从异常栈来看,问题出在WPF资源字典加载、主题样式应用阶段,可按以下顺序尝试修复:

  • 重置VS用户设置:以管理员身份打开命令提示符,执行 devenv /resetuserdata,重置后重启VS,尝试打开解决方案。
  • 修复VS安装:打开Visual Studio Installer,选择对应的VS 2022实例,点击“修改”→“修复”,等待修复完成后重启系统再试。
  • 禁用所有扩展:空启动VS,进入扩展管理界面,禁用所有第三方扩展,重启后测试是否还会崩溃。如果恢复正常,再逐个启用扩展排查问题来源。
  • 删除VS缓存文件:删除以下路径的缓存文件夹,然后重启VS:
    • %LOCALAPPDATA%\Microsoft\VisualStudio\<版本号>\ComponentModelCache
    • %LOCALAPPDATA%\Microsoft\VisualStudio\<版本号>\Cache
  • 切换VS主题:空启动VS后,先切换到默认的“浅色”或“深色”主题,再尝试打开解决方案,避免自定义主题导致的资源加载异常。
  • 检查系统WPF相关组件:确保.NET Framework 4.8及以上版本已正确安装,可通过控制面板的“程序和功能”查看并修复.NET Framework。

内容的提问来源于stack exchange,提问作者cdmdotnet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 09:44:52