Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2017 Test Explorer window null reference exception

So basically when I open my solution with nunit3 & specflow, selenium UI tests in VS 2017 (15.3.2.) I get the following exception and error on test explorer window:

enter image description here

Is there a way to fix this? There is a work around but its ridiculous... If I start VS 2017 without any project and then open the project from recent- its working OK.

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>
like image 942
Rain9333 Avatar asked Oct 29 '22 03:10

Rain9333


1 Answers

The issue appears if you have Test Explorer on focus upon start up. The temp solution is to click on another TAB (Solution explorer) before closing VisualStudio so the focus won't be on TestExplorer on startup.

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

like image 143
valentinvs Avatar answered Dec 22 '22 09:12

valentinvs