title: Bug: VS2017 Live Unit Testing - only minus's - doesn't work
body: <p><strong>TL;DR; Edit 6:</strong> I have narrowed it down and provided 5 steps to reproduce the problem/bug. </p>
  
  <ol>
  <li>Create a VS2017 c# Console App (.Net Full Framework)  </li>
  <li>Add a method to the Program.cs and make the class public:   </li>
  </ol>
  
  <p>&nbsp;</p>
  
  <pre><code>public class Program
  {
      static void Main(string[] args)
      {
      }
  
      public int Add(int a, int b)
      { 
          return a + b;
      }
  }
  }
  </code></pre>
  
  <ol start="3">
  <li>Right click the <code>Add</code> Method and choose Create Unit Test:</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/Uif8Z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Uif8Z.png" alt="enter image description here"></a></p>
  
  <ol start="4">
  <li>Use these settings to create a new Unit Test Project with the test:</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/v5IXn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/v5IXn.png" alt="enter image description here"></a></p>
  
  <ol start="5">
  <li>Add a Unit Test</li>
  </ol>
  
  <p>&nbsp;</p>
  
  <pre><code>[TestMethod()]
  public void AddTest()
  {
      Program p = new Program();
      var r = p.Add(1, 2);
  
      Assert.IsTrue(3 == r);
  }
  </code></pre>
  
  <ul>
  <li>Test Menu > Live Unit Testing > Start</li>
  <li>Context menu over the <code>AddTest()</code> > Live Testing > Include</li>
  </ul>
  
  <p>Now change the Add's <strong>+</strong> symbol to <strong>-</strong></p>
  
  <p>The Live Unit Testing works, change the  <strong>-</strong> symbol back to a <strong>+</strong> and the Live Test passes!!</p>
  
  <p><strong>Now Add a reference to a Nuget DLL (anyone will do) - Live Unit Testing no longer works!   Or simply close the Solution, re-open it and Live Unit Testing no longer works!</strong></p>
  
  <hr> 
  
  <p>I've setup a MSUnitTest v2 project and started Live Unit Testing. I am using a Web Api 2 .Net project (Full Framework v4.5.2).</p>
  
  <p>I see the Minus signs everywhere but no Tick's or Crosses. </p>
  
  <p>I change code the same as they do in the <a href="https://www.youtube.com/watch?v=kBlLi4BYCKk" rel="noreferrer">Live Unit Testing in Visual Studio 2017 video</a> and the clocks appear over the minus's but then nothing...</p>
  
  <p><a href="https://i.stack.imgur.com/bW4KI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bW4KI.png" alt="enter image description here"></a></p>
  
  <p>The unit test will pass when I debug it:</p>
  
  <p><a href="https://i.stack.imgur.com/ANh5l.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ANh5l.png" alt="enter image description here"></a></p>
  
  <p>When I hover the mouse over the blue minus's the message is "Covered by 0 Tests"</p>
  
  <p>I have found that you need the <strong>MSTest.TestAdapter</strong> and <strong>MSTest.TestFramework</strong> as per <a href="https://developercommunity.visualstudio.com/content/problem/5520/live-unit-test-are-only-showing-minuses-using-micr.html" rel="noreferrer">https://developercommunity.visualstudio.com/content/problem/5520/live-unit-test-are-only-showing-minuses-using-micr.html</a> which I have done and am referencing both V1.18:</p>
  
  <ul>
  <li>Microsoft.VisualStudio.TestPlatform.TestFramework</li>
  <li>Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions</li>
  </ul>
  
  <p>There are a bunch of beta testers who reported the same problem:</p>
  
  <p><a href="https://developercommunity.visualstudio.com/content/problem/4510/live-unit-testing-doesnt-do-anything-1.html" rel="noreferrer">https://developercommunity.visualstudio.com/content/problem/4510/live-unit-testing-doesnt-do-anything-1.html</a></p>
  
  <p><a href="https://developercommunity.visualstudio.com/content/problem/2737/live-unit-testing-doesnt-do-anything.html" rel="noreferrer">https://developercommunity.visualstudio.com/content/problem/2737/live-unit-testing-doesnt-do-anything.html</a></p>
  
  <p><a href="https://developercommunity.visualstudio.com/content/problem/4376/live-unit-testing-doesnt-work.html" rel="noreferrer">https://developercommunity.visualstudio.com/content/problem/4376/live-unit-testing-doesnt-work.html</a></p>
  
  <p><a href="https://developercommunity.visualstudio.com/content/problem/2527/live-unit-testing-doesnt-work-for-projects-that-im.html" rel="noreferrer">https://developercommunity.visualstudio.com/content/problem/2527/live-unit-testing-doesnt-work-for-projects-that-im.html</a></p>
  
  <p>All posts are resolved or wont fix.</p>
  
  <p>This <a href="https://stackoverflow.com/questions/43591499/visual-studio-2017-live-unit-testing-does-not-work">Stackoverflow user got an issue with Live Unit Testing but its a Null Exception</a> problem. I tried the <a href="https://developercommunity.visualstudio.com/content/problem/56681/unable-to-run-tests.html" rel="noreferrer">solution in comments</a> to remove the Microsoft.VisualStudio.QualityTools.UnitTestFramework from the Gac, when I tried to uninstall from C:\Windows\assembly I got an access denied and uninstalling via a Developer Command Prompt: </p>
  
  <pre><code>GacUtil /u Microsoft.VisualStudio.QualityTools.UnitTestFramework
  </code></pre>
  
  <p>Results in:</p>
  
  <blockquote>
    <p>Assembly: Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
    Unable to uninstall: assembly is required by one or more applications</p>
  </blockquote>
  
  <p><strong>Could someone help me get Live Unit Testing to work?</strong></p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>In VS > Tools > Options > Live Unit testing I turned logging to Verbose.</p>
  
  <p>Looking at the output I saw one warning:</p>
  
  <blockquote>
    <p>[15:48:26.521 Verbose] - TestDriver - TestDiscoverer log message: Warning - Configuration system failed to initialize</p>
  </blockquote>
  
  <p>Following a few answers in <a href="https://stackoverflow.com/questions/6436157/configuration-system-failed-to-initialize">this</a> I still wasn't able to get rid of the "Configuration system failed to initialize" - not sure if this is a red-herring or not, its the only clue I've found so far...</p>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>I ran VS2017 as Admin and that got rid of the "Configuration system failed to initialize". Unfortunately running as Admin doesn't make a difference, it still doesn't work but doesn't fail with any exceptions.</p>
  
  <hr>
  
  <p>Here is Verbose log. Its interesting that "Preparing to start test discovery" looks like its found the x86 Test I have included.</p>
  
  <p>However, it clearly cannot discover the test; "Discovered 0 tests"</p>
  
  <pre><code>[16:52:55.110 Verbose] - Aggregator - Calculating the set of tests that cover 1 files  
  [16:52:55.110 Verbose] - Aggregator - [Workflow 4] Sending TestRequestEvent with 6 assemblies and 0 tests  
  [16:52:55.110 Verbose] - TestDriver - [Workflow 4] Received TestRequestEvent  
  [16:52:55.110 Verbose] - TestDriver - [Workflow 4] Preparing to start test discovery (X64: 0, X86: 1).  
  [16:52:55.110 Verbose] - TestDriver - [Workflow 4] Start discovering tests from group 0, which contains 1 assemblies.  
  [16:52:55.599 Verbose] - TestDriver - [Workflow 4] Finished discovering test from group 0.  
  [16:52:55.599 Verbose] - TestDriver - [Workflow 4] Discovered 0 tests from XYZ.API.ClientService\bin\Debug\XYZ.API.ClientService.dll, updating cached data.  
  [16:52:55.599 Verbose] - TestDriver - [Workflow 4] Notify Aggregator about completion of test run. (Passed: 0, Failed: 0, Run succeeded: True)  
  [16:52:55.599 Verbose] - Aggregator - [Workflow 4] Received TestResponseEvent (TestRunCompleted)  
  [16:52:55.599 Verbose] - Aggregator - [Workflow 4] Coverage data for 0 tests was received during this workflow  
  [16:52:55.600 Verbose] - BuildManager - Allow to send a single build event.  
  [16:52:55.599 Verbose] - Aggregator - Starting coverage aggregation cycle - work list has 3 methods  
  [16:52:55.599 Verbose] - Aggregator - Finished coverage aggregation cycle - work list had 3 methods of which 3 methods were defined in 2 open files  
  [16:52:55.600 Verbose] - BuildManager - Interrupting build queue -&gt; no new assemblies.  
  [16:52:55.600 Verbose] - StatusMargin - Received file coverage result  
  [16:52:55.599 Verbose] - Aggregator - Sending FileCoverageResult for 'C:\XYZProjectCollection\XYZ\XYZ.API.ClientService\Repositories\ValueRepository.cs - C:\XYZProjectCollection\Lincoln\XYZ.API.ClientService\XYZ.API.MiscService.csproj'
  [16:52:55.599 Verbose] - Aggregator - [Workflow 4] Sending TestRunCompletedEvent  
  </code></pre>
  
  <p><strong>Edit 3:</strong></p>
  
  <p>I had a look through ProcessMonitor traces today.. nothing really stood out, I could have missed something but I'm starting to feel this is a bug not a config problem. </p>
  
  <p>I'm working in a really locked down environment so it could be that something was blocked during vs2017 install. I know Unity3D domain is not whitelisted for downloads. Although all core Visual Studio Microsoft stuff is installed. I'm starting to run out of diagnostic troubleshooting strategy's. Any ideas very welcome!</p>
  
  <p><strong>Edit 4:</strong></p>
  
  <p>This morning I decided to get rid of the <code>Microsoft.VisualStudio.QualityTools.UnitTestFramework</code> DLL from the GAC. I did it following <a href="https://social.msdn.microsoft.com/Forums/en-US/484e9c4a-8d5d-4965-8b1d-a109821ba7da/gac-uninstall?forum=netfx64bit" rel="noreferrer">these instructions to overcome the Access Denied</a>:</p>
  
  <p><a href="https://i.stack.imgur.com/2noop.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2noop.png" alt="enter image description here"></a></p>
  
  <p>This led to finding one of the potential root causes. I started seeing the Live Unit Testing Logging outputing:</p>
  
  <pre><code>[09:44:59.053 Verbose] - BuildManager - C:\Program Files x86\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3245,5): error MSB3491: Could not write lines to file "C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\i\XYZ.API.MiscService\Debug\CoreCompileInputs.cache". Access to the path 'C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\i\XYZ.API.MiscService\Debug\CoreCompileInputs.cache' is denied.   
  [09:44:59.053 Verbose] - BuildManager - C:\Program Files x86\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4874,5): error MSB3491: Could not write lines to file "C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\i\XYZ.API.MiscService\Debug\XYZ.API.MiscService.csproj.FileListAbsolute.txt". Access to the path 'C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\i\XYZ.API.MiscService\Debug\XYZ.API.MiscService.csproj.FileListAbsolute.txt' is denied.
  </code></pre>
  
  <p>I gave myself permission to all those directories, just to rule out any permissions issues:</p>
  
  <p><a href="https://i.stack.imgur.com/4hRzV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4hRzV.png" alt="enter image description here"></a></p>
  
  <p>This still doesn't work, however it seems I am getting closer as the Live Unit Tests are taking a little longer to <em>not</em> work (ie the clocks that appear on top of the minus's take longer to process).</p>
  
  <p>Then I tried ProcMon again and it showed some interesting logs but no smoking gun.</p>
  
  <p>Here is the current Verbose Log:</p>
  
  <pre><code>[10:22:07.363 Info] - BuildManager - Build completed (succeeded).
  [10:22:07.363 Verbose] - BuildManager - Interrupting build queue -&gt; switching 'build' and 'test' directories.
  [10:22:07.363 Verbose] - BuildManager - New 'test' directory: C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\1\
  [10:22:07.363 Verbose] - BuildManager - New 'build' directory: C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\0\
  [10:22:07.363 Verbose] - Aggregator - [Workflow 4] Received BuildEvent.
  [10:22:07.363 Verbose] - Aggregator - assembly: C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.Tests\bin\Debug\XYZ.API.Tests.dll
  [10:22:07.363 Verbose] - Aggregator - assembly: C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.AccountClientService\bin\Debug\XYZ.API.AccountClientService.dll
  [10:22:07.363 Verbose] - Aggregator - assembly: C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API\bin\XYZ.API.dll
  [10:22:07.363 Verbose] - Aggregator - assembly: C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.Helpers\bin\Debug\XYZ.API.Global.dll
  [10:22:07.363 Verbose] - Aggregator - assembly: C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.MiscService\bin\Debug\XYZ.API.MiscService.dll
  [10:22:07.363 Verbose] - Aggregator - file: 'C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\Repositories\ValueRepository.cs - C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\XYZ.API.MiscService.csproj'
  [10:22:07.363 Verbose] - Aggregator - Skip reading spans for assembly C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.Tests\bin\Debug\XYZ.API.Tests.dll with MVID c96c0f4b-b21e-47be-a71e-97ebf8a3d493 since we already have this information from a previous build
  [10:22:07.363 Verbose] - Aggregator - Skip reading spans for assembly C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.AccountClientService\bin\Debug\XYZ.API.AccountClientService.dll with MVID 6772f896-04ab-4804-bb18-3ed2c7aeb9b9 since we already have this information from a previous build
  [10:22:07.363 Verbose] - Aggregator - Skip reading spans for assembly C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API\bin\XYZ.API.dll with MVID 9c862440-c16a-4efe-8574-76e8c1453c4d since we already have this information from a previous build
  [10:22:07.363 Verbose] - Aggregator - Skip reading spans for assembly C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.Helpers\bin\Debug\XYZ.API.Global.dll with MVID a8899d5d-4730-46bf-b4f2-3c2b1b75b0b1 since we already have this information from a previous build
  [10:22:07.363 Verbose] - Aggregator - Removing MVID f337ca44-aae6-42ca-8df5-3776ff962372 for project C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\XYZ.API.MiscService.csproj from the file span cache
  [10:22:07.363 Verbose] - Aggregator - Adding MVID 8e944276-0eec-43f4-aff3-07e40f8611dc for project C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\XYZ.API.MiscService.csproj to the file span cache
  [10:22:07.363 Verbose] - Aggregator - Calculating the set of tests that cover 0 files
  [10:22:07.363 Verbose] - Aggregator - Reading spans for assembly C:\XYZProjectCollection\Lincoln\.vs\XYZ.API\18528\t\XYZ.API.MiscService\bin\Debug\XYZ.API.MiscService.dll with MVID 8e944276-0eec-43f4-aff3-07e40f8611dc
  [10:22:07.363 Verbose] - Aggregator - Adding 3 methods from 'C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\Repositories\ValueRepository.cs - C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\XYZ.API.MiscService.csproj' to the coverage aggregation work list
  [10:22:07.363 Verbose] - Aggregator - Calculating the set of tests that cover 1 files
  [10:22:07.363 Verbose] - Aggregator - [Workflow 4] Sending TestRequestEvent with 5 assemblies and 0 tests
  [10:22:07.363 Verbose] - TestDriver - [Workflow 4] Received TestRequestEvent
  [10:22:07.363 Verbose] - TestDriver - [Workflow 4] Preparing to start test discovery (X64: 0, X86: 1).
  [10:22:07.363 Verbose] - TestDriver - [Workflow 4] Start discovering tests from group 0, which contains 1 assemblies.
  [10:22:07.834 Verbose] - TestDriver - [Workflow 4] Finished discovering test from group 0.
  [10:22:07.834 Verbose] - TestDriver - [Workflow 4] Discovered 0 tests from XYZ.API.MiscService\bin\Debug\XYZ.API.MiscService.dll, updating cached data.
  [10:22:07.834 Verbose] - TestDriver - [Workflow 4] Notify Aggregator about completion of test run. (Passed: 0, Failed: 0, Run succeeded: True)
  [10:22:07.834 Verbose] - Aggregator - [Workflow 4] Received TestResponseEvent (TestRunCompleted)
  [10:22:07.834 Verbose] - Aggregator - [Workflow 4] Coverage data for 0 tests was received during this workflow
  [10:22:07.834 Verbose] - Aggregator - Starting coverage aggregation cycle - work list has 3 methods
  [10:22:07.834 Verbose] - Aggregator - Finished coverage aggregation cycle - work list had 3 methods of which 3 methods were defined in 5 open files
  [10:22:07.834 Verbose] - BuildManager - Allow to send a single build event.
  [10:22:07.834 Verbose] - BuildManager - Interrupting build queue -&gt; no new assemblies.
  [10:22:07.834 Verbose] - Aggregator - Sending FileCoverageResult for 'C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\Repositories\ValueRepository.cs - C:\XYZProjectCollection\Lincoln\XYZ.API.MiscService\XYZ.API.MiscService.csproj'
  [10:22:07.834 Verbose] - Aggregator - [Workflow 4] Sending TestRunCompletedEvent
  [10:22:07.850 Verbose] - StatusMargin - Received file coverage result
  </code></pre>
  
  <p><strong>Edit 5:</strong></p>
  
  <p>According to this blog:
  <a href="https://blogs.msdn.microsoft.com/visualstudio/2017/03/09/live-unit-testing-in-visual-studio-2017-enterprise/" rel="noreferrer">https://blogs.msdn.microsoft.com/visualstudio/2017/03/09/live-unit-testing-in-visual-studio-2017-enterprise/</a></p>
  
  <p><strong>Q: Why does nothing happen after I include or exclude tests from Live Test Set?</strong></p>
  
  <p>A: This is a known issue which we were not able to fix in Visual Studio 2017 version 15.0. It is now fixed in Visual Studio 2017 version 15.2.</p>
  
  <p>Turns out I have Visual Studio/15.0.0 +26228.9. Upgrading to Visual Studio 2017 (v15.2) DOES <strong>NOT</strong> fix the problem.</p>
  
  <p>I have reported the issue to <a href="https://developercommunity.visualstudio.com" rel="noreferrer">https://developercommunity.visualstudio.com</a> and will keep everyone posted. It properly didn't get reported the environment is locked.</p>