Testhost.exe已退出,代码为-1(0xffffffff)

时间:2018-10-30 21:56:40

标签: unit-testing azure-devops runsettings

我正在尝试通过构建管道中的变量组,使用从KeyVault导出的机密覆盖集成测试中的一些变量。

我添加了一个.runsettings文件,并且在通过测试调试时能够检索伪变量。但是,一旦执行了读取哑数值的指令后,测试突然退出,并且出现以下错误:

Value of CrmClientSecret is JustSomeSecret
Step into: Stepping over non-user code 
'IntegrationTests.Helpers.Helper.DeleteUserFromCRM' Step into: Stepping over 
non-user code 'IntegrationTests.Helpers.Helper. d__4..ctor' 'testhost.exe' 
(CLR v4.0.30319: TestSourceHost: Enumering source 
(C:\source\repos\Azure\Integrat ionTests\bin\Debug\Tests.dll)): Loaded 
'C:\source\repos\Azure\IntegrationTests\bin\Debug\Utilities.dll'. Symbols 
loaded. The thread 0x527c has exited with code 0 (0x0). The program '[26720] 
testhost.exe' has exited with code -1 (0xffffffff). The program '[26720] 
testhost.exe: Program Trace' has exited with code 0 (0x0).

Any help is appreciated

该解决方案托管在Visual Studio Ent 2017中。测试项目为net 4.61,并安装了以下Nuget软件包:

  1. Microsoft.NET.Test.Sdk v 15.9.0
  2. MSTest.TestAdapter v 1.3.2
  3. MSTest.TestFramework v 1.3.2
  4. NUnit3TestAdapter版本3.11.0

这是我的测试结果:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<MaxCpuCount>2</MaxCpuCount>
<ResultsDirectory>.\TestResults</ResultsDirectory>
<TargetPlatform>x64</TargetPlatform>
<TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
<TestAdaptersPaths>%systemdrive%\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\TESTPLATFORM\Extensions</TestAdaptersPaths>
<TestSessionTimeout>10000</TestSessionTimeout>
</RunConfiguration>
<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>
<ModulePaths>
<Exclude>
<ModulePath>.*CPPUnitTestFramework.*</ModulePath>
</Exclude>
</ModulePaths>
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
<CollectFromChildProcesses>True</CollectFromChildProcesses>
<CollectAspDotNet>False</CollectAspDotNet>
</CodeCoverage>
</Configuration>
</DataCollector>
<DataCollector uri="datacollector://microsoft/VideoRecorder/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder.VideoRecorderDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Screen and Voice Recorder">
 </DataCollector>
 </DataCollectors>
 </DataCollectionRunSettings>
 <TestRunParameters>
 <Parameter name="AmbassadorsDbConnectionString"
 value="TheConnectionString" />
<Parameter name="CRMClientSecret" value="JustSomeSecret" />
<Parameter name="webAppPassword" value="Password" />    
</TestRunParameters>
<MSTest>
  <MapInconclusiveToFailed>True</MapInconclusiveToFailed>
  <CaptureTraceOutput>false</CaptureTraceOutput>  
  <DeleteDeploymentDirectoryAfterTestRunIsComplete>False
<DeploymentEnabled>False</DeploymentEnabled>
<AssemblyResolution>
  <Directory path="D:\myfolder\bin\" includeSubDirectories="false"/>
</AssemblyResolution>
</MSTest>
</RunSettings>

1 个答案:

答案 0 :(得分:0)

您可以使用blame选项来收集转储并分析崩溃的原因

https://github.com/Microsoft/vstest-docs/blob/master/RFCs/0024-Blame-Collector-Options.md