2014-07-01 9 views
8

मैं vstest.console.exe उपयोग कर रहा हूँ (VS2012)/EnableCodeCoverage साथ परीक्षण चलाने के लिए, और एक .runsettings है कि एक "कोड कवरेज" DataCollector को परिभाषित करता है के साथ (नीचे दिए गए कोड ब्लॉक में CodeCoverage.runsettings देखें)।vstest.console.exe/enableCodeCoverage के साथ बस "hangs" ... कैसे डिबग, और कैसे ठीक करें?

मैं एक powershell निर्माण स्क्रिप्ट, कि invokes से चल रहा हूँ:

vstest.console.exe/inIsolation/लॉगर: TRX/EnableCodeCoverage /Settings:CodeCoverage.runsettings/TestCaseFilter: "TestCategory = ग्राहकों" बिन \ रिलीज \ Sdm.Test.IntegTest.dll

पहले यह आदेश काम कर रहा था, हालांकि हाल ही में एक नई परियोजना जो कुछ पुराने विरासत कोड को एकीकृत करती है, ने कई नई निर्भरताओं/डीएलएल लाए हैं।

मैं क्या देखते हैं कि आदेश सिर्फ "रुक जाता है" है, और कभी नहीं परीक्षण के किसी भी चलाने के लिए लगता है। जब मैं SysInternals प्रोसेस एक्सप्लोरर का उपयोग मैं vstest.executionengine.exe में कुछ गतिविधि देखते हैं ... मेरी सबसे अच्छी अनुमान यह साधन करने के लिए DLLs कि मेरे .runsettings फ़ाइल का कहना है कि बाहर रखा जाना चाहिए की एक पूरी गुच्छा प्रयास कर रहा है है। लेकिन यह केवल एक अनुमान है।

पता लगाना समस्या का निदान करने के लिए कैसे में किसी भी मदद की सराहना की जाएगी। नीचे

CodeCoverage.runsettings:

<?xml version="1.0" encoding="utf-8"?> 
<RunSettings> 
    <!-- Configurations that affect the Test Framework --> 
    <RunConfiguration> 
    <!-- Path relative to solution directory --> 
    <ResultsDirectory>.\TestResults</ResultsDirectory> 

    <!-- [x86] | x64 
     - You can also change it from menu Test, Test Settings, Default Processor Architecture --> 
    <TargetPlatform>x64</TargetPlatform> 

    <!-- Framework35 | [Framework40] | Framework45 --> 
    <TargetFrameworkVersion>Framework45</TargetFrameworkVersion> 
    </RunConfiguration> 

    <!-- Configurations for data collectors --> 
    <DataCollectionRunSettings> 
    <DataCollectors> 
     <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"> 
     <Configuration> 
      <CodeCoverage> 

      <!-- 
      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. 
      --> 

      <!--   
      <SymbolSearchPaths>    
        <Path>C:\Users\User\Documents\Visual Studio 2012\Projects\ProjectX\bin\Debug</Path> 
        <Path>\\mybuildshare\builds\ProjectX</Path> 
      </SymbolSearchPaths> 
      --> 

      <!-- 
      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. 
      --> 

      <!-- Match assembly file paths: --> 
      <ModulePaths> 
       <Include> 
       <ModulePath>.*\.dll$</ModulePath> 
       <ModulePath>.*\.exe$</ModulePath> 
       </Include> 
       <Exclude> 
       <ModulePath>.*CPPUnitTestFramework.*</ModulePath> 
       <ModulePath>.*[uU]nit[tT]est\.dll</ModulePath> 
       <ModulePath>.*[iI]nteg[tT]est\.dll</ModulePath> 
       <ModulePath>.*bomicustomautopoco\.dll</ModulePath> 
       <ModulePath>.*Common\.Logging\.dll</ModulePath> 
       <ModulePath>.*Common\.Logging\.Log4Net129.dll</ModulePath> 
       <ModulePath>.*fluentassertions\.dll</ModulePath> 
       <ModulePath>.*x509publickeyparser\.dll</ModulePath> 
       <ModulePath>.*EFCachingProvider\.dll</ModulePath> 
       <ModulePath>.*EFProviderWrapperToolkit\.dll</ModulePath> 
       <ModulePath>.*log4net\.dll</ModulePath> 
       <ModulePath>.*DatahelperDTCBridge\.dll</ModulePath> 
       <ModulePath>.*\.ni\.dll</ModulePath> 
       <ModulePath>.*mscorlib\.dll</ModulePath> 
       <ModulePath>.*vjslib\.dll</ModulePath> 
       <ModulePath>.*Microsoft\..*dll</ModulePath> 
       <ModulePath>.*System\.EnterpriseServices\..*dll</ModulePath> 
       <ModulePath>.*System\.ComponentModel\..*dll</ModulePath> 
       <ModulePath>.*System\.Configuration\..*dll</ModulePath> 
       <ModulePath>.*System\.Core\..*dll</ModulePath> 
       <ModulePath>.*System\.Data\..*dll</ModulePath> 
       <ModulePath>.*System\.Entity\..*dll</ModulePath> 
       <ModulePath>.*System\.IdentityModel\..*dll</ModulePath> 
       <ModulePath>.*System\.Numerics\..*dll</ModulePath> 
       <ModulePath>.*System\.Runtime\..*dll</ModulePath> 
       <ModulePath>.*System\.ServiceModel\..*dll</ModulePath> 
       <ModulePath>.*System\.Transactions\..*dll</ModulePath> 
       <ModulePath>.*System\.Web\..*dll</ModulePath> 
       <ModulePath>.*System\.Xml\..*dll</ModulePath> 
       <ModulePath>.*msdia110typelib_clr0200\.dll</ModulePath> 
       <ModulePath>.*vstest.executionengine.exe</ModulePath> 
       <ModulePath>.*BOMi2Service\.dll</ModulePath> 
       <ModulePath>.*NakedObjects\..*dll</ModulePath> 
       <ModulePath>.*nakedobjects\..*dll</ModulePath> 
       <ModulePath>.*sdm\.corejava\.dll</ModulePath> 
       <ModulePath>.*sdm\.datahelper\.dll</ModulePath> 
       <ModulePath>.*sdm\.events\.dll</ModulePath> 
       <ModulePath>.*Sdm\.Infrastructure\.dll</ModulePath> 
       <ModulePath>.*Sdm\.Infrastructure\.Attributes\.dll</ModulePath> 
       <ModulePath>.*sdm\.systems\.application\.dll</ModulePath> 
       <ModulePath>.*sdm\.systems\.distribution\.library\.dll</ModulePath> 
       <ModulePath>.*sdm\.systems\.distribution\.server\.dll</ModulePath> 
       <ModulePath>.*sdm\.objectstore\.dll</ModulePath> 
       <ModulePath>.*sdm\.profiler\.dll</ModulePath> 
       <ModulePath>.*sdm\.resultsprocessor\.dll</ModulePath> 
       <ModulePath>.*sdm\.systems\.reflector\.dll</ModulePath> 
       <ModulePath>.*Sdm\.Test\.Fixtures\.dll</ModulePath> 
       <ModulePath>.*sdm\.utilities\.dll</ModulePath> 
       <ModulePath>.*Spring\.Core\.dll</ModulePath> 
       <ModulePath>.*TechTalk\.SpecFlow\.dll</ModulePath> 
       </Exclude> 
      </ModulePaths> 

      <!-- Match fully qualified names of functions: --> 
      <!-- (Use "\." to delimit namespaces in C# or Visual Basic, "::" in C++.) --> 
      <Functions> 
       <Exclude> 
       <Function>^Fabrikam\.UnitTest\..*</Function> 
       <Function>^std::.*</Function> 
       <Function>^ATL::.*</Function> 
       <Function>.*::__GetTestMethodInfo.*</Function> 
       <Function>^Microsoft::VisualStudio::CppCodeCoverageFramework::.*</Function> 
       <Function>^Microsoft::VisualStudio::CppUnitTestFramework::.*</Function> 
       </Exclude> 
      </Functions> 

      <!-- Match attributes on any code element: --> 
      <Attributes> 
       <Exclude> 
       <!-- Don’t forget "Attribute" at the end of the name --> 
       <Attribute>^System.Diagnostics.DebuggerHiddenAttribute$</Attribute> 
       <Attribute>^System.Diagnostics.DebuggerNonUserCodeAttribute$</Attribute> 
       <Attribute>^System.Runtime.CompilerServices.CompilerGeneratedAttribute$</Attribute> 
       <Attribute>^System.CodeDom.Compiler.GeneratedCodeAttribute$</Attribute> 
       <Attribute>^System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute$</Attribute> 
       </Exclude> 
      </Attributes> 

      <!-- Match the path of the source files in which each method is defined: --> 
      <Sources> 
       <Exclude> 
       <Source>.*\\atlmfc\\.*</Source> 
       <Source>.*\\vctools\\.*</Source> 
       <Source>.*\\public\\sdk\\.*</Source> 
       <Source>.*\\microsoft sdks\\.*</Source> 
       <Source>.*\\vc\\include\\.*</Source> 
       </Exclude> 
      </Sources> 

      <!-- Match the company name property in the assembly: --> 
      <CompanyNames> 
       <Exclude> 
       <CompanyName>.*microsoft.*</CompanyName> 
       </Exclude> 
      </CompanyNames> 

      <!-- Match the public key token of a signed assembly: --> 
      <PublicKeyTokens> 
       <!-- Exclude Visual Studio extensions: --> 
       <Exclude> 
       <PublicKeyToken>^B77A5C561934E089$</PublicKeyToken> 
       <PublicKeyToken>^B03F5F7F11D50A3A$</PublicKeyToken> 
       <PublicKeyToken>^31BF3856AD364E35$</PublicKeyToken> 
       <PublicKeyToken>^89845DCD8080CC91$</PublicKeyToken> 
       <PublicKeyToken>^71E9BCE111E9429C$</PublicKeyToken> 
       <PublicKeyToken>^8F50407C4E9E73B6$</PublicKeyToken> 
       <PublicKeyToken>^E361AF139669C375$</PublicKeyToken> 
       </Exclude> 
      </PublicKeyTokens> 


      <!-- We recommend you do not change the following values: --> 
      <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation> 
      <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses> 
      <CollectFromChildProcesses>True</CollectFromChildProcesses> 
      <CollectAspDotNet>False</CollectAspDotNet>   


      </CodeCoverage> 
     </Configuration> 
     </DataCollector> 

    </DataCollectors> 
    </DataCollectionRunSettings> 

    <!-- Adapter Specific sections --> 

    <!-- MSTest adapter --> 
    <MSTest> 
    <MapInconclusiveToFailed>True</MapInconclusiveToFailed> 
    <CaptureTraceOutput>false</CaptureTraceOutput> 
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete> 
    <DeploymentEnabled>False</DeploymentEnabled> 
    </MSTest> 


</RunSettings> 

उत्तर

14

केवल सुराग मैं मिल सकता है कि अंततः एक समाधान करने के लिए नेतृत्व ईवेंट व्यूअर में था, विशेष रूप से:

.NET Runtime version 2.0.50727.5477 - Failed to CoCreate profiler. 

यह किया था अंत में मुझे एक करने के लिए नेतृत्व ठीक, जोड़ने के लिए है जो: (64 बिट चल रहा है, तो)

<startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0.30319" /> 
</startup>   

vstest.executionengine.exe.config को या vstest.executionengine.x86.exe.config (यदि 32 बिट चल रहा हो)।

:

यह दोनों वी.एस. (जब devenv.exe द्वारा पैदा की) के तहत और कमांड लाइन (जब vstest.console.exe द्वारा पैदा की)

यहाँ से काम करता है कुछ नोट है कि मुझे इस समाधान करने के लिए मिल गया है

संदर्भित नए डीएलएल में .NET 2.0 के विरुद्ध बनाए गए कुछ पुराने पुराने कोड शामिल हैं। खोज का एक बहुत बाद, मैं में इकट्ठा कर लिया है कि:

  • vstest.executionengine.exe .NET 4 रूपरेखा सामान का उपयोग करता है गतिशील कोड कवरेज उपकरण
  • घटना दर्शक त्रुटि संदेश करने के लिए एक अस्पष्ट सुराग है कि vstest.executionengine.exe .NET 2.0 प्रोफाइलर
  • जैसा कि ऊपर उल्लेख शुरू करने के लिए विफल हो रहा है, ठीक .config अद्यतन करने के लिए (जो है, vstest.executionengine.exe.config) है।

इस सामग्री को परीक्षण वाले प्रोजेक्ट के app.config में जोड़ना संभव नहीं है; यह vstest.executionengine की कॉन्फ़िगरेशन में जाना चाहिए (क्योंकि यह वास्तव में चल रहा है exe)।

अन्य चीजें मैंने कोशिश की (जिनमें से कोई भी, अंततः, मदद की): रजिस्ट्री

Computer\HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\EnterpriseTools\QualityTools\Diagnostics 
  • EnableTracing DWORD = 1
  • TraceLevel DWORD = 4 में

    निदान

* .Config फ़ाइलों में 0

निदान

vstest.console.exe के लिए

, vstest.discoveryengine * exe, vstest.executionengine * exe

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow 

कहा:।।।।

<system.diagnostics> 
    <switches> 
     <add name="TpTraceLevel" value="4" /> 
    </switches> 
    </system.diagnostics> 

... इस का कारण बनता है लॉग फाइल% TEMP% करने के लिए लिखे जाने की

रेड हेरिंग: की कोशिश की स्थापना के माहौल onment चर निष्क्रिय करने के लिए

- COR_ENABLE_PROFILING=0 
- COMPLUS_ProfAPI_ProfilerCompatibilitySetting=DisableV2Profiler 

... .नेट 2 प्रोफाइलर को निष्क्रिय करने की कोशिश में है, लेकिन कुछ नहीं किया।

आगे की जांच (procexp.exe का उपयोग करके) ने दिखाया कि vstest.executionengine.exe हमेशा env var के बावजूद COR_ENABLE_PROFILING = 1 सेट करता है।

इसके अलावा, COR_PROFILER के सेट मेरे लिए guid को

  • , COR_PROFILER = {B19F184A-CC62-4137-9A6F-AF0F91730165}
  • regedit के माध्यम से, HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes \ CLSID {B19F184A-CC62 था -4137-9A6F-AF0F91730165} \ InprocServer32
  • "सी: \ प्रोग्राम फ़ाइलें (x86) \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ IntelliTrace \ 11.0.0 \ x64 \ Microsoft.IntelliTrace.Profiler से मेल खाता है .11.0.0.dll "
% TEMP% में

.NET Runtime version 4.0.30319.18063 - The profiler was loaded successfully. Profiler CLSID: '{b19f184a-cc62-4137-9a6f-af0f91730165}'. Process ID (decimal): 7700. Message ID: [0x2507]. 

लॉग फाइल भी कोई मुद्दा सुझाव: 91,363,210

घटना दर्शक को देखते हुए मैं जानकारी संदेश जो .NET 4 प्रोफाइलर सफलतापूर्वक प्रारंभ हो गया देखा।

रेड हेरिंग: अन्य रास्ता तय करना है, और env के माध्यम से सक्षम की कोशिश की वार्स:

COMPLUS_ProfAPI_ProfilerCompatibilitySetting=EnableV2Profiler 
and also explicitly set 
COR_PROFILER={B19F184A-CC62-4137-9A6F-AF0F91730165} 

या तो कोई फर्क पड़ा।

अन्य लाल herrings

    फार्म के ईवेंट व्यूअर में
  • कभी संदेशों:

    इंजन :: notify_process_attach अपवाद के साथ विफल हुआ: सत्र "MTM_7d145e0c-1c26-44b0-89e5-acc448aaae6d" नहीं है मौजूद।

  • vstest.discoveryengine.TpTrace.log ... त्रुटि "AddProcess: AddProcess 5 में विफल" भी अप्रासंगिक प्रतीत होता है।

    'System.EventHandler`1 [Microsoft.VisualStudio.TestTools.Execution.SessionStartEventArgs]' 'Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector' को मैं, 2800, 11, 2014/7/1, 10: 59: 11.875 , पीसीकेएमए 044 \ vstest.discoveryengine.exe, कमांड लाइन unregister/वाइल्डकार्ड/सत्र के साथ वैंगौर्ड प्रक्रिया शुरू की: MTM_ * I, 2800, 11, 2014/07/01, 10: 59: 11.880, पीसीकेएमए 044 \ vstest.discoveryengine.exe, प्रोजेक्ट ऑब्जेक्ट डब्ल्यू, 2800, 11, 2014/07/01, 10: 59: 11.882, पीसीकेएमए 04419 \ vstest.discoveryengine.exe, AddProcess: AddProcess में विफल 5 I, 2800, 11, 2014/07 में Vangaurd प्रक्रिया जोड़ें/01, 10: 59: 11.882, पीसीकेएमए 044 \ vstest.discoveryengine.exe, कमांड लाइन संग्रह/सत्र के साथ वैंगौर्ड प्रक्रिया शुरू की: MTM_64f33307-c936-469e-b068-482ec0ea45cf/आउटपुट: "सी: \ उपयोगकर्ता \ danhaywoo घ \ AppData \ Local \ अस्थायी \ MTM_64f33307-c936-469e-b068-482ec0ea45cf \ c44e78af-2475-4747-99f3-e0fc3ca41d51 \ DanHaywood_PCKMA0419 2014-07-01 10_59_11.coverage "/ config:

" सी : \ Users \ danhaywood \ AppData \ Local \ अस्थायी \ MTM_64f33307-c936-469e-b068-482ec0ea45cf \ CodeCoverage.config " ~~~

ब्लॉग रास्ते से सलाह ली:

संबंधित मुद्दे