【问题标题】:Opening the Code Analysis Ruleset editor crashes Visual Studio打开代码分析规则集编辑器会导致 Visual Studio 崩溃
【发布时间】:2020-06-30 09:27:21
【问题描述】:

每次我尝试对代码分析执行任何操作时,Visual Studio 都会崩溃。事件查看器显示崩溃是由无效的窗口拆分器大小引起的。

堆栈跟踪:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentOutOfRangeException
   at System.Windows.Forms.SplitContainer.set_SplitterDistance(Int32)
   at Microsoft.VisualStudio.CodeAnalysis.AdvancedRuleSetEdit.LoadHelpPaneSizeString(System.String)
   at Microsoft.VisualStudio.CodeAnalysis.AdvancedRuleSetEdit.LoadHelpPaneSettings()
   at Microsoft.VisualStudio.CodeAnalysis.AdvancedRuleSetEdit.SplitterResized(System.Object, System.EventArgs)
   at System.Windows.Forms.Control.OnResize(System.EventArgs)
   at System.Windows.Forms.Control.OnSizeChanged(System.EventArgs)
   at System.Windows.Forms.Control.UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)
   at System.Windows.Forms.Control.UpdateBounds()
   at System.Windows.Forms.Control.WmWindowPosChanged(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.ContainerControl.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.SplitContainer.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)

【问题讨论】:

    标签: visual-studio-2019 fxcop roslyn-code-analysis


    【解决方案1】:

    Procmon 显示此值存储在私有注册表 bin 文件中。

    删除代码分析的窗口设置可修复崩溃的原因。您可能需要在每次关闭 Visual Studio 时执行此操作。

    从私有注册表bin中导出:

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\vs2019\Software\Microsoft\VisualStudio\16.0_ad070b97\CodeAnalysis]
    "RuleSetMRUList"=""
    "RuleSelectionControl_Settings"="True,True,True,7,2,0,True,0;True;0.385#1;False;0.160#2;True;0.429#3;False;0.160#4;False;0.100#5;True;0.186#6;False;0.150#7;False;0.150#"
    "RuleSetEditorHelpPaneSize"="573,573"
    

    如果你遇到这个问题,要解决:

    // put your instance id in the next line instead of ad070b97
    cd C:\Users\Administrator\AppData\Local\Microsoft\VisualStudio\16.0_ad070b97
    reg load HKLM\vs2019 privateregistry.bin
    reg delete HKLM\vs2019\Software\Microsoft\VisualStudio\16.0_ad070b97\CodeAnalysis /v RuleSetEditorHelpPaneSize
    reg unload HKLM\vs2019
    

    在最新的 VS 2019 版本中修复

    【讨论】:

    • 在 VS 2019 版本 16.7.2 中仍可能发生此崩溃 - 此处的此修复仍然有效。 (至少在我的机器上。)这个有用的答案使我无法重新安装 VS 或整个操作系统。
    • 我现在在最新的马厩(16.7.6)上,它又崩溃了……不能移动的分离器有什么意义?如果你努力,你会崩溃的......
    【解决方案2】:

    这是由您的显示器的缩放选项引起的。 (使文本和图标变大的部分。)

    将缩放比例重置为 100%,它将显示窗口。 vs 中还有其他控制也会导致问题,但是这个会导致它崩溃。如果大于 100,vs 2017 的各个部分都不起作用。这使它崩溃,表单设计器抱怨,并且在解决方案属性页面中显示错误消息。 (不是项目属性)

    似乎微软从未有时间测试或修复此问题。

    测试确认。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      相关资源
      最近更新 更多