title: vstest.console.exe with /EnableCodeCoverage just "hangs"... how debug, and how to fix?
body: <p>I'm using vstest.console.exe (VS2012) to run tests with /EnableCodeCoverage, and with a .runsettings that defines a "Code Coverage" DataCollector (see CodeCoverage.runsettings in code block below).</p>
  
  <p>I'm running from a powershell build script, that invokes:</p>
  
  <p>vstest.console.exe /inIsolation /Logger:trx /EnableCodeCoverage /Settings:CodeCoverage.runsettings /TestCaseFilter:"TestCategory=Customers" bin\Release\Sdm.Test.IntegTest.dll</p>
  
  <p>Previously this command was working, however a recent new project that integrated some old legacy code has brought in a lot of new dependencies/DLLs.</p>
  
  <p>What I see is that the command just "hangs", and never seems to run any of the tests. When I use the SysInternals Process Explorer I do see some activity in vstest.executionengine.exe ... my best guess is that it is attempting to instrument a whole bunch of DLLs that my .runsettings file say should be excluded.  But that's only a guess.  </p>
  
  <p>Any help in figuring out how to diagnose the issue would be appreciated.</p>
  
  <p>CodeCoverage.runsettings below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RunSettings&gt;
    &lt;!-- Configurations that affect the Test Framework --&gt;
    &lt;RunConfiguration&gt;
      &lt;!-- Path relative to solution directory --&gt;
      &lt;ResultsDirectory&gt;.\TestResults&lt;/ResultsDirectory&gt;
  
      &lt;!-- [x86] | x64  
        - You can also change it from menu Test, Test Settings, Default Processor Architecture --&gt;
      &lt;TargetPlatform&gt;x64&lt;/TargetPlatform&gt;
  
      &lt;!-- Framework35 | [Framework40] | Framework45 --&gt;
      &lt;TargetFrameworkVersion&gt;Framework45&lt;/TargetFrameworkVersion&gt;
    &lt;/RunConfiguration&gt;
  
    &lt;!-- Configurations for data collectors --&gt;
    &lt;DataCollectionRunSettings&gt;
      &lt;DataCollectors&gt;
        &lt;DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&gt;
          &lt;Configuration&gt;
            &lt;CodeCoverage&gt;
  
              &lt;!--
              Additional paths to search for .pdb (symbol) files. Symbols must be found for modules to be instrumented.
              If .pdb files are in the same folder as the .dll or .exe files, they are automatically found. Otherwise, specify them here.
              Note that searching for symbols increases code coverage runtime. So keep this small and local.
              --&gt;
  
              &lt;!--           
              &lt;SymbolSearchPaths&gt;              
                     &lt;Path&gt;C:\Users\User\Documents\Visual Studio 2012\Projects\ProjectX\bin\Debug&lt;/Path&gt;
                     &lt;Path&gt;\\mybuildshare\builds\ProjectX&lt;/Path&gt;
              &lt;/SymbolSearchPaths&gt;
              --&gt;
  
              &lt;!--
              About include/exclude lists:
              Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
              Each element in the list is a regular expression (ECMAScript syntax). See http://msdn.microsoft.com/library/2k3te2cs.aspx.
              An item must first match at least one entry in the include list to be included.
              Included items must then not match any entries in the exclude list to remain included.
              --&gt;
  
              &lt;!-- Match assembly file paths: --&gt;
              &lt;ModulePaths&gt;
                &lt;Include&gt;
                  &lt;ModulePath&gt;.*\.dll$&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*\.exe$&lt;/ModulePath&gt;
                &lt;/Include&gt;
                &lt;Exclude&gt;
                  &lt;ModulePath&gt;.*CPPUnitTestFramework.*&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*[uU]nit[tT]est\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*[iI]nteg[tT]est\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*bomicustomautopoco\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*Common\.Logging\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*Common\.Logging\.Log4Net129.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*fluentassertions\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*x509publickeyparser\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*EFCachingProvider\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*EFProviderWrapperToolkit\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*log4net\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*DatahelperDTCBridge\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*\.ni\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*mscorlib\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*vjslib\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*Microsoft\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.EnterpriseServices\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.ComponentModel\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Configuration\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Core\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Data\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Entity\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.IdentityModel\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Numerics\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Runtime\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.ServiceModel\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Transactions\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Web\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*System\.Xml\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*msdia110typelib_clr0200\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*vstest.executionengine.exe&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*BOMi2Service\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*NakedObjects\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*nakedobjects\..*dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.corejava\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.datahelper\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.events\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*Sdm\.Infrastructure\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*Sdm\.Infrastructure\.Attributes\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.systems\.application\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.systems\.distribution\.library\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.systems\.distribution\.server\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.objectstore\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.profiler\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.resultsprocessor\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.systems\.reflector\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*Sdm\.Test\.Fixtures\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*sdm\.utilities\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*Spring\.Core\.dll&lt;/ModulePath&gt;
                  &lt;ModulePath&gt;.*TechTalk\.SpecFlow\.dll&lt;/ModulePath&gt;
                &lt;/Exclude&gt;
              &lt;/ModulePaths&gt;
  
              &lt;!-- Match fully qualified names of functions: --&gt;
              &lt;!-- (Use "\." to delimit namespaces in C# or Visual Basic, "::" in C++.)  --&gt;
              &lt;Functions&gt;
                &lt;Exclude&gt;
                  &lt;Function&gt;^Fabrikam\.UnitTest\..*&lt;/Function&gt;
                  &lt;Function&gt;^std::.*&lt;/Function&gt;
                  &lt;Function&gt;^ATL::.*&lt;/Function&gt;
                  &lt;Function&gt;.*::__GetTestMethodInfo.*&lt;/Function&gt;
                  &lt;Function&gt;^Microsoft::VisualStudio::CppCodeCoverageFramework::.*&lt;/Function&gt;
                  &lt;Function&gt;^Microsoft::VisualStudio::CppUnitTestFramework::.*&lt;/Function&gt;
                &lt;/Exclude&gt;
              &lt;/Functions&gt;
  
              &lt;!-- Match attributes on any code element: --&gt;
              &lt;Attributes&gt;
                &lt;Exclude&gt;
                  &lt;!-- Don’t forget "Attribute" at the end of the name --&gt;
                  &lt;Attribute&gt;^System.Diagnostics.DebuggerHiddenAttribute$&lt;/Attribute&gt;
                  &lt;Attribute&gt;^System.Diagnostics.DebuggerNonUserCodeAttribute$&lt;/Attribute&gt;
                  &lt;Attribute&gt;^System.Runtime.CompilerServices.CompilerGeneratedAttribute$&lt;/Attribute&gt;
                  &lt;Attribute&gt;^System.CodeDom.Compiler.GeneratedCodeAttribute$&lt;/Attribute&gt;
                  &lt;Attribute&gt;^System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute$&lt;/Attribute&gt;
                &lt;/Exclude&gt;
              &lt;/Attributes&gt;
  
              &lt;!-- Match the path of the source files in which each method is defined: --&gt;
              &lt;Sources&gt;
                &lt;Exclude&gt;
                  &lt;Source&gt;.*\\atlmfc\\.*&lt;/Source&gt;
                  &lt;Source&gt;.*\\vctools\\.*&lt;/Source&gt;
                  &lt;Source&gt;.*\\public\\sdk\\.*&lt;/Source&gt;
                  &lt;Source&gt;.*\\microsoft sdks\\.*&lt;/Source&gt;
                  &lt;Source&gt;.*\\vc\\include\\.*&lt;/Source&gt;
                &lt;/Exclude&gt;
              &lt;/Sources&gt;
  
              &lt;!-- Match the company name property in the assembly: --&gt;
              &lt;CompanyNames&gt;
                &lt;Exclude&gt;
                  &lt;CompanyName&gt;.*microsoft.*&lt;/CompanyName&gt;
                &lt;/Exclude&gt;
              &lt;/CompanyNames&gt;
  
              &lt;!-- Match the public key token of a signed assembly: --&gt;
              &lt;PublicKeyTokens&gt;
                &lt;!-- Exclude Visual Studio extensions: --&gt;
                &lt;Exclude&gt;
                  &lt;PublicKeyToken&gt;^B77A5C561934E089$&lt;/PublicKeyToken&gt;
                  &lt;PublicKeyToken&gt;^B03F5F7F11D50A3A$&lt;/PublicKeyToken&gt;
                  &lt;PublicKeyToken&gt;^31BF3856AD364E35$&lt;/PublicKeyToken&gt;
                  &lt;PublicKeyToken&gt;^89845DCD8080CC91$&lt;/PublicKeyToken&gt;
                  &lt;PublicKeyToken&gt;^71E9BCE111E9429C$&lt;/PublicKeyToken&gt;
                  &lt;PublicKeyToken&gt;^8F50407C4E9E73B6$&lt;/PublicKeyToken&gt;
                  &lt;PublicKeyToken&gt;^E361AF139669C375$&lt;/PublicKeyToken&gt;
                &lt;/Exclude&gt;
              &lt;/PublicKeyTokens&gt;
  
  
              &lt;!-- We recommend you do not change the following values: --&gt;
              &lt;UseVerifiableInstrumentation&gt;True&lt;/UseVerifiableInstrumentation&gt;
              &lt;AllowLowIntegrityProcesses&gt;True&lt;/AllowLowIntegrityProcesses&gt;
              &lt;CollectFromChildProcesses&gt;True&lt;/CollectFromChildProcesses&gt;
              &lt;CollectAspDotNet&gt;False&lt;/CollectAspDotNet&gt;          
  
  
            &lt;/CodeCoverage&gt;
          &lt;/Configuration&gt;
        &lt;/DataCollector&gt;
  
      &lt;/DataCollectors&gt;
    &lt;/DataCollectionRunSettings&gt;
  
    &lt;!-- Adapter Specific sections --&gt;
  
    &lt;!-- MSTest adapter --&gt;
    &lt;MSTest&gt;
      &lt;MapInconclusiveToFailed&gt;True&lt;/MapInconclusiveToFailed&gt;
      &lt;CaptureTraceOutput&gt;false&lt;/CaptureTraceOutput&gt;
      &lt;DeleteDeploymentDirectoryAfterTestRunIsComplete&gt;False&lt;/DeleteDeploymentDirectoryAfterTestRunIsComplete&gt;
      &lt;DeploymentEnabled&gt;False&lt;/DeploymentEnabled&gt;
    &lt;/MSTest&gt;
  
  
  &lt;/RunSettings&gt;
  </code></pre>