VS 2017 测试资源管理器窗口空引用异常

Rai*_*333 5 specflow nunit-3.0 visual-studio-2017

因此,基本上当我在 VS 2017 (15.3.2.) 中使用 nunit3 和 specflow、selenium UI 测试打开我的解决方案时,我在测试资源管理器窗口中收到以下异常和错误:

在此处输入图片说明

有没有办法来解决这个问题?有一个解决方法,但它很荒谬......如果我在没有任何项目的情况下启动 VS 2017,然后从最近打开项目 - 它的工作正常。

An exception was encountered while constructing the content of this frame.  This information is also logged in "C:\Users\USER\AppData\Roaming\Microsoft\VisualStudio\15.0_6ae63cad\ActivityLog.xml".

Exception details:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.TestWindow.VsHost.TestWindowToolWindow.InvokeSwapInRealTestWindow(String eventName)
   at Microsoft.VisualStudio.TestWindow.VsHost.TestWindowToolWindow.OnToolWindowCreated()
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, UInt32 flags)
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, ProvideToolWindowAttribute tool)
   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 Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsToolWindowFactory.CreateToolWindow(Guid& toolWindowType, UInt32 id)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()


ActivityLog.xml content:

  <entry>
    <record>678</record>
    <time>2017/09/15 12:43:31.678</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>Construction of frame content failed.&#x000D;&#x000A;Frame identifier: ST:0:0:{e1b7d1f8-9b3c-49b1-8f4f-bfc63a88835d}&#x000D;&#x000A;Frame caption: Test Explorer&#x000D;&#x000A;Exception details:&#x000D;&#x000A;System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at Microsoft.VisualStudio.TestWindow.VsHost.TestWindowToolWindow.InvokeSwapInRealTestWindow(String eventName)&#x000D;&#x000A;   at Microsoft.VisualStudio.TestWindow.VsHost.TestWindowToolWindow.OnToolWindowCreated()&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, UInt32 flags)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, ProvideToolWindowAttribute tool)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute tool)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Guid&amp; toolWindowType, Int32 id)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsToolWindowFactory.CreateToolWindow(Guid&amp; toolWindowType, UInt32 id)&#x000D;&#x000A;   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()</description>
  </entry>
Run Code Online (Sandbox Code Playgroud)

val*_*nvs 2

如果您在启动时将测试资源管理器置于焦点上,则会出现此问题。临时解决方案是在关闭 VisualStudio 之前单击另一个 TAB(解决方案资源管理器),这样焦点就不会在启动时位于 TestExplorer 上。

参考: https: //developercommunity.visualstudio.com/content/problem/117601/test-explorer-nullreferenceexception-on-startup.html