microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.49k stars 2.61k forks source link

VS Testing Step seems to hate me #4798

Closed TehWardy closed 7 years ago

TehWardy commented 7 years ago

I have an existing Windows 10 based build server that runs my builds and recently I tried setting up a new one using Windows Server 2016 as we now have a windows AD driven domain so I need new boxes on the domain (VM based).

The new Build box started complaining with this exception in some unit tests when calling in to some third party code ...

NCalc.EvaluationException: Type 'System.Diagnostics.TraceEventCache' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

... as this was the first time I had ever seen this issue I figured I had done something wrong but apart from the domain controller the only difference I could think of was the fact that the OS was Windows Server 2016.

So I built a new build box, this time a Windows 10 VM and followed the same setup steps ...

This windows 10 based one is giving the following build output ...

Microsoft (R) Test Execution Command Line Tool Version 15.0.26228.0
Copyright (c) Microsoft Corporation.  All rights reserved.
Error: The test source file "Agent\_work\_temp\tmpD112.tmp" provided was not found.
Error: The /Diag parameter requires a file to be provided to write the logs.
Usage:
vstest.console.exe [TestFileNames] /Diag:%temp%\testlog.txt
Processed: ##vso[task.uploadfile]C:\Build Agent\_work\_temp\tmpD112.tmp
Processed: ##vso[task.logissue type=error;TaskName=VSTest;code=VSTest Test Run failed with exit code1]
System.Exception: VSTest Test Run failed with exit code: 1
Processed: ##vso[task.logissue type=error;]System.Exception: VSTest Test Run failed with exit code: 1
FindFiles.FindMatchingFiles(rootFolder = C:\Build Agent\_work\1\s\TestResults, matchPattern = *.trx, includeFiles = True, includeFolders = False
FindFiles.GetMatchingItems(includePatterns.Count = 1, excludePatterns.Count = 0, includeFiles = True, includeFolders = False
FindFiles.FindMatchingFiles - Found 0 matches
Processed: ##vso[task.logissue type=warning;code=002003;]
No results found to publish.
Processed: ##vso[task.logissue type=warning]No results found to publish.
Leaving script VSTest.ps1
PowerShell script completed with 1 errors.
******************************************************************************
Finishing: Execute all tests (Dev)
******************************************************************************

so my question is ... What do I need to do to get a VSTest step to work in my build process as this is really frustrating and I can't see anything wrong with the code as locally this is all fine?

vimegh commented 7 years ago

As per logs it seems test source file is incorrectly provided. Error: The test source file "Agent_work_temp\tmpD112.tmp" provided was not found.

Can you please check that correct dll file is provided as source.

Also in case you still face an issue, please add system.debug = true in task definition variable and then run the task, and share with us the log generated. Thanks.

TehWardy commented 7 years ago

Hi vimegh,

This is executed as part of my build process, the task configuration is just given the build root to go on and should be finding all tests in my build output directory tree.

For local builds or builds executed from tfs on the old build server this is all fine.

In short ... I don't directly give the testing task any files so I'm a little confused, and the above contains everything output in the log for the testing task in the build process.

vimegh commented 7 years ago

@TehWardy Prima facie it seems from the log you shared that filter specified by you is incorrect. You might be giving some filter criteria to test task where it is not able to find any test dlls. Regarding output of log, if you add a variable system.debug with value set to true in you build definition and then run the definition, then it will produce more log messages, and that could help us investigate the problem. If you don't want to share the logs here on github, you can email those to us at devops_tools[AT]microsoft[DOT]com Thanks.

TehWardy commented 7 years ago

I'm not sure I understand what you mean by "the filter", this is a step in my build process ...

image

unless you're referring to the "Test Assembly parameter?" ...

Dev*\.Tests.dll;-:\obj\

This works on our old build server so why not the new ones? I'm a little confused as to why 3 machines given the same build definition all behave differently.

I'm running the same build, and that build is building 1 solution that has all our projects and test projects in it.

TehWardy commented 7 years ago

Here's the entire log for that step (surely you don't want the whole build log right?) ...

******************************************************************************
Finishing: Deploy (to dev)
******************************************************************************
Evaluating condition for step: 'Execute Tests (Dev)'
Evaluating: succeeded()
Evaluating succeeded:
=> (Boolean) True
Expanded: True
Result: True
******************************************************************************
Starting: Execute Tests (Dev)
******************************************************************************
==============================================================================
Task         : Visual Studio Test
Description  : Run tests with Visual Studio test runner
Version      : 1.0.85
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=624539)
==============================================================================
Preparing task execution handler.
Executing the powershell script: C:\Build Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\1.0.85\VSTest.ps1
PowerShellHandler.Execute - AddCommand(C:\Build Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\1.0.85\VSTest.ps1)
PowerShellHandler.Execute - Add inputParameters
PowerShellHandler.Execute - AddParameter(testAssembly=Dev\**\*.Tests.dll;-:**\obj\**)
PowerShellHandler.Execute - AddParameter(testFiltercriteria=)
PowerShellHandler.Execute - AddParameter(runSettingsFile=C:\Build Agent\_work\1\s)
PowerShellHandler.Execute - AddParameter(overrideTestrunParameters=)
PowerShellHandler.Execute - AddParameter(codeCoverageEnabled=false)
PowerShellHandler.Execute - AddParameter(runInParallel=false)
PowerShellHandler.Execute - AddParameter(vstestLocationMethod=version)
PowerShellHandler.Execute - AddParameter(vsTestVersion=latest)
PowerShellHandler.Execute - AddParameter(vstestLocation=)
PowerShellHandler.Execute - AddParameter(pathtoCustomTestAdapters=)
PowerShellHandler.Execute - AddParameter(otherConsoleOptions=)
PowerShellHandler.Execute - AddParameter(testRunTitle=)
PowerShellHandler.Execute - AddParameter(platform=any cpu)
PowerShellHandler.Execute - AddParameter(configuration=Test)
PowerShellHandler.Execute - AddParameter(publishRunAttachments=true)
PowerShellHandler.Execute - Invoke
Entering script VSTest.ps1
vsTestVersion = latest
testAssembly = Dev\**\*.Tests.dll;-:**\obj\**
testFiltercriteria =
runSettingsFile = C:\Build Agent\_work\1\s
codeCoverageEnabled = false
pathtoCustomTestAdapters =
overrideTestrunParameters =
otherConsoleOptions =
testRunTitle =
platform = any cpu
configuration = Test
publishRunAttachments = true
vstestLocation =
Loading module from path 'C:\Build Agent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.psd1'.
Loading module from path 'C:\Build Agent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.psm1'.
Loading module from path 'C:\Build Agent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.LegacySDK.dll'.
Importing cmdlet 'Invoke-ResultPublisher'.
Importing cmdlet 'Publish-TestResults'.
Importing cmdlet 'Add-BuildArtifactLink'.
Importing cmdlet 'Add-BuildAttachment'.
Importing cmdlet 'Convert-String'.
Importing cmdlet 'Copy-BuildArtifact'.
Importing cmdlet 'Get-JavaDevelopmentKitPath'.
Importing cmdlet 'Get-MSBuildLocation'.
Importing cmdlet 'Get-ServiceEndpoint'.
Importing cmdlet 'Get-TaskVariable'.
Importing cmdlet 'Get-TfsClientCredentials'.
Importing cmdlet 'Get-ToolPath'.
Importing cmdlet 'Get-VisualStudioPath'.
Importing cmdlet 'Get-VssConnection'.
Importing cmdlet 'Invoke-Ant'.
Importing cmdlet 'Invoke-BatchScript'.
Importing cmdlet 'Invoke-Maven'.
Importing cmdlet 'Invoke-MSBuild'.
Importing cmdlet 'Invoke-Tool'.
Importing cmdlet 'Invoke-VSTest'.
Importing cmdlet 'Publish-BuildArtifact'.
Importing cmdlet 'Register-XamarinLicense'.
Importing cmdlet 'Unregister-XamarinLicense'.
Importing cmdlet 'Get-X509Certificate'.
Importing cmdlet 'Invoke-DeployTestAgent'.
Importing cmdlet 'Invoke-RunDistributedTests'.
Importing cmdlet 'Invoke-BlockEnvironment'.
Importing cmdlet 'Copy-FilesToAzureBlob'.
Importing cmdlet 'Copy-FilesToTargetMachine'.
Importing cmdlet 'Copy-ToAzureMachines'.
Importing cmdlet 'Remove-Environment'.
Importing cmdlet 'Remove-EnvironmentResources'.
Importing cmdlet 'Complete-EnvironmentOperation'.
Importing cmdlet 'Complete-EnvironmentResourceOperation'.
Importing cmdlet 'Complete-ResourceOperation'.
Importing cmdlet 'Get-Environment'.
Importing cmdlet 'Get-EnvironmentProperty'.
Importing cmdlet 'Get-EnvironmentResources'.
Importing cmdlet 'Get-ExternalIpAddress'.
Importing cmdlet 'Get-ParsedSessionVariables'.
Importing cmdlet 'Get-ProviderData'.
Importing cmdlet 'Invoke-EnvironmentOperation'.
Importing cmdlet 'Invoke-ResourceOperation'.
Importing cmdlet 'Invoke-PsOnRemote'.
Importing cmdlet 'New-OperationLog'.
Importing cmdlet 'Copy-FilesToRemote'.
Importing cmdlet 'Register-Environment'.
Importing cmdlet 'Register-EnvironmentDefinition'.
Importing cmdlet 'Register-Provider'.
Importing cmdlet 'Register-ProviderData'.
Importing cmdlet 'Invoke-UnblockEnvironment'.
Importing cmdlet 'Add-TaskIssue'.
Importing cmdlet 'Complete-Task'.
Importing cmdlet 'Find-Files'.
Importing cmdlet 'Get-LocalizedString'.
Importing cmdlet 'Set-TaskProgress'.
Importing cmdlet 'Set-TaskVariable'.
Importing cmdlet 'Write-TaskDetail'.
Importing cmdlet 'Enable-CodeCoverage'.
Importing cmdlet 'Publish-CodeCoverage'.
Exporting cmdlet 'Add-BuildArtifactLink'.
Exporting cmdlet 'Add-BuildAttachment'.
Exporting cmdlet 'Convert-String'.
Exporting cmdlet 'Copy-BuildArtifact'.
Exporting cmdlet 'Get-JavaDevelopmentKitPath'.
Exporting cmdlet 'Get-MSBuildLocation'.
Exporting cmdlet 'Get-ServiceEndpoint'.
Exporting cmdlet 'Get-TaskVariable'.
Exporting cmdlet 'Get-TfsClientCredentials'.
Exporting cmdlet 'Get-ToolPath'.
Exporting cmdlet 'Get-VisualStudioPath'.
Exporting cmdlet 'Get-VssConnection'.
Exporting cmdlet 'Invoke-Ant'.
Exporting cmdlet 'Invoke-BatchScript'.
Exporting cmdlet 'Invoke-Maven'.
Exporting cmdlet 'Invoke-MSBuild'.
Exporting cmdlet 'Invoke-Tool'.
Exporting cmdlet 'Invoke-VSTest'.
Exporting cmdlet 'Publish-BuildArtifact'.
Exporting cmdlet 'Register-XamarinLicense'.
Exporting cmdlet 'Unregister-XamarinLicense'.
Exporting cmdlet 'Get-X509Certificate'.
Importing cmdlet 'Add-BuildArtifactLink'.
Importing cmdlet 'Add-BuildAttachment'.
Importing cmdlet 'Convert-String'.
Importing cmdlet 'Copy-BuildArtifact'.
Importing cmdlet 'Get-JavaDevelopmentKitPath'.
Importing cmdlet 'Get-MSBuildLocation'.
Importing cmdlet 'Get-ServiceEndpoint'.
Importing cmdlet 'Get-TaskVariable'.
Importing cmdlet 'Get-TfsClientCredentials'.
Importing cmdlet 'Get-ToolPath'.
Importing cmdlet 'Get-VisualStudioPath'.
Importing cmdlet 'Get-VssConnection'.
Importing cmdlet 'Get-X509Certificate'.
Importing cmdlet 'Invoke-Ant'.
Importing cmdlet 'Invoke-BatchScript'.
Importing cmdlet 'Invoke-Maven'.
Importing cmdlet 'Invoke-MSBuild'.
Importing cmdlet 'Invoke-Tool'.
Importing cmdlet 'Invoke-VSTest'.
Importing cmdlet 'Publish-BuildArtifact'.
Importing cmdlet 'Register-XamarinLicense'.
Importing cmdlet 'Unregister-XamarinLicense'.
Loading module from path 'C:\Build Agent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.psd1'.
Loading module from path 'C:\Build Agent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.psm1'.
Importing cmdlet 'Invoke-ResultPublisher'.
Importing cmdlet 'Publish-TestResults'.
Importing cmdlet 'Add-BuildArtifactLink'.
Importing cmdlet 'Add-BuildAttachment'.
Importing cmdlet 'Convert-String'.
Importing cmdlet 'Copy-BuildArtifact'.
Importing cmdlet 'Get-JavaDevelopmentKitPath'.
Importing cmdlet 'Get-MSBuildLocation'.
Importing cmdlet 'Get-ServiceEndpoint'.
Importing cmdlet 'Get-TaskVariable'.
Importing cmdlet 'Get-TfsClientCredentials'.
Importing cmdlet 'Get-ToolPath'.
Importing cmdlet 'Get-VisualStudioPath'.
Importing cmdlet 'Get-VssConnection'.
Importing cmdlet 'Invoke-Ant'.
Importing cmdlet 'Invoke-BatchScript'.
Importing cmdlet 'Invoke-Maven'.
Importing cmdlet 'Invoke-MSBuild'.
Importing cmdlet 'Invoke-Tool'.
Importing cmdlet 'Invoke-VSTest'.
Importing cmdlet 'Publish-BuildArtifact'.
Importing cmdlet 'Register-XamarinLicense'.
Importing cmdlet 'Unregister-XamarinLicense'.
Importing cmdlet 'Get-X509Certificate'.
Importing cmdlet 'Invoke-DeployTestAgent'.
Importing cmdlet 'Invoke-RunDistributedTests'.
Importing cmdlet 'Invoke-BlockEnvironment'.
Importing cmdlet 'Copy-FilesToAzureBlob'.
Importing cmdlet 'Copy-FilesToTargetMachine'.
Importing cmdlet 'Copy-ToAzureMachines'.
Importing cmdlet 'Remove-Environment'.
Importing cmdlet 'Remove-EnvironmentResources'.
Importing cmdlet 'Complete-EnvironmentOperation'.
Importing cmdlet 'Complete-EnvironmentResourceOperation'.
Importing cmdlet 'Complete-ResourceOperation'.
Importing cmdlet 'Get-Environment'.
Importing cmdlet 'Get-EnvironmentProperty'.
Importing cmdlet 'Get-EnvironmentResources'.
Importing cmdlet 'Get-ExternalIpAddress'.
Importing cmdlet 'Get-ParsedSessionVariables'.
Importing cmdlet 'Get-ProviderData'.
Importing cmdlet 'Invoke-EnvironmentOperation'.
Importing cmdlet 'Invoke-ResourceOperation'.
Importing cmdlet 'Invoke-PsOnRemote'.
Importing cmdlet 'New-OperationLog'.
Importing cmdlet 'Copy-FilesToRemote'.
Importing cmdlet 'Register-Environment'.
Importing cmdlet 'Register-EnvironmentDefinition'.
Importing cmdlet 'Register-Provider'.
Importing cmdlet 'Register-ProviderData'.
Importing cmdlet 'Invoke-UnblockEnvironment'.
Importing cmdlet 'Add-TaskIssue'.
Importing cmdlet 'Complete-Task'.
Importing cmdlet 'Find-Files'.
Importing cmdlet 'Get-LocalizedString'.
Importing cmdlet 'Set-TaskProgress'.
Importing cmdlet 'Set-TaskVariable'.
Importing cmdlet 'Write-TaskDetail'.
Importing cmdlet 'Enable-CodeCoverage'.
Importing cmdlet 'Publish-CodeCoverage'.
Exporting cmdlet 'Add-TaskIssue'.
Exporting cmdlet 'Complete-Task'.
Exporting cmdlet 'Find-Files'.
Exporting cmdlet 'Get-LocalizedString'.
Exporting cmdlet 'Set-TaskProgress'.
Exporting cmdlet 'Set-TaskVariable'.
Exporting cmdlet 'Write-TaskDetail'.
Importing cmdlet 'Add-TaskIssue'.
Importing cmdlet 'Complete-Task'.
Importing cmdlet 'Find-Files'.
Importing cmdlet 'Get-LocalizedString'.
Importing cmdlet 'Set-TaskProgress'.
Importing cmdlet 'Set-TaskVariable'.
Importing cmdlet 'Write-TaskDetail'.
Loading module from path 'C:\Build Agent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.TestResults\Microsoft.TeamFoundation.DistributedTask.Task.TestResults.psm1'.
Importing cmdlet 'Invoke-ResultPublisher'.
Importing cmdlet 'Publish-TestResults'.
Importing cmdlet 'Add-BuildArtifactLink'.
Importing cmdlet 'Add-BuildAttachment'.
Importing cmdlet 'Convert-String'.
Importing cmdlet 'Copy-BuildArtifact'.
Importing cmdlet 'Get-JavaDevelopmentKitPath'.
Importing cmdlet 'Get-MSBuildLocation'.
Importing cmdlet 'Get-ServiceEndpoint'.
Importing cmdlet 'Get-TaskVariable'.
Importing cmdlet 'Get-TfsClientCredentials'.
Importing cmdlet 'Get-ToolPath'.
Importing cmdlet 'Get-VisualStudioPath'.
Importing cmdlet 'Get-VssConnection'.
Importing cmdlet 'Invoke-Ant'.
Importing cmdlet 'Invoke-BatchScript'.
Importing cmdlet 'Invoke-Maven'.
Importing cmdlet 'Invoke-MSBuild'.
Importing cmdlet 'Invoke-Tool'.
Importing cmdlet 'Invoke-VSTest'.
Importing cmdlet 'Publish-BuildArtifact'.
Importing cmdlet 'Register-XamarinLicense'.
Importing cmdlet 'Unregister-XamarinLicense'.
Importing cmdlet 'Get-X509Certificate'.
Importing cmdlet 'Invoke-DeployTestAgent'.
Importing cmdlet 'Invoke-RunDistributedTests'.
Importing cmdlet 'Invoke-BlockEnvironment'.
Importing cmdlet 'Copy-FilesToAzureBlob'.
Importing cmdlet 'Copy-FilesToTargetMachine'.
Importing cmdlet 'Copy-ToAzureMachines'.
Importing cmdlet 'Remove-Environment'.
Importing cmdlet 'Remove-EnvironmentResources'.
Importing cmdlet 'Complete-EnvironmentOperation'.
Importing cmdlet 'Complete-EnvironmentResourceOperation'.
Importing cmdlet 'Complete-ResourceOperation'.
Importing cmdlet 'Get-Environment'.
Importing cmdlet 'Get-EnvironmentProperty'.
Importing cmdlet 'Get-EnvironmentResources'.
Importing cmdlet 'Get-ExternalIpAddress'.
Importing cmdlet 'Get-ParsedSessionVariables'.
Importing cmdlet 'Get-ProviderData'.
Importing cmdlet 'Invoke-EnvironmentOperation'.
Importing cmdlet 'Invoke-ResourceOperation'.
Importing cmdlet 'Invoke-PsOnRemote'.
Importing cmdlet 'New-OperationLog'.
Importing cmdlet 'Copy-FilesToRemote'.
Importing cmdlet 'Register-Environment'.
Importing cmdlet 'Register-EnvironmentDefinition'.
Importing cmdlet 'Register-Provider'.
Importing cmdlet 'Register-ProviderData'.
Importing cmdlet 'Invoke-UnblockEnvironment'.
Importing cmdlet 'Add-TaskIssue'.
Importing cmdlet 'Complete-Task'.
Importing cmdlet 'Find-Files'.
Importing cmdlet 'Get-LocalizedString'.
Importing cmdlet 'Set-TaskProgress'.
Importing cmdlet 'Set-TaskVariable'.
Importing cmdlet 'Write-TaskDetail'.
Importing cmdlet 'Enable-CodeCoverage'.
Importing cmdlet 'Publish-CodeCoverage'.
Exporting cmdlet 'Invoke-ResultPublisher'.
Exporting cmdlet 'Publish-TestResults'.
Importing cmdlet 'Invoke-ResultPublisher'.
Importing cmdlet 'Publish-TestResults'.
Loading module from path 'C:\Build Agent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.CodeCoverage\Microsoft.TeamFoundation.DistributedTask.Task.CodeCoverage.psm1'.
Importing cmdlet 'Invoke-ResultPublisher'.
Importing cmdlet 'Publish-TestResults'.
Importing cmdlet 'Add-BuildArtifactLink'.
Importing cmdlet 'Add-BuildAttachment'.
Importing cmdlet 'Convert-String'.
Importing cmdlet 'Copy-BuildArtifact'.
Importing cmdlet 'Get-JavaDevelopmentKitPath'.
Importing cmdlet 'Get-MSBuildLocation'.
Importing cmdlet 'Get-ServiceEndpoint'.
Importing cmdlet 'Get-TaskVariable'.
Importing cmdlet 'Get-TfsClientCredentials'.
Importing cmdlet 'Get-ToolPath'.
Importing cmdlet 'Get-VisualStudioPath'.
Importing cmdlet 'Get-VssConnection'.
Importing cmdlet 'Invoke-Ant'.
Importing cmdlet 'Invoke-BatchScript'.
Importing cmdlet 'Invoke-Maven'.
Importing cmdlet 'Invoke-MSBuild'.
Importing cmdlet 'Invoke-Tool'.
Importing cmdlet 'Invoke-VSTest'.
Importing cmdlet 'Publish-BuildArtifact'.
Importing cmdlet 'Register-XamarinLicense'.
Importing cmdlet 'Unregister-XamarinLicense'.
Importing cmdlet 'Get-X509Certificate'.
Importing cmdlet 'Invoke-DeployTestAgent'.
Importing cmdlet 'Invoke-RunDistributedTests'.
Importing cmdlet 'Invoke-BlockEnvironment'.
Importing cmdlet 'Copy-FilesToAzureBlob'.
Importing cmdlet 'Copy-FilesToTargetMachine'.
Importing cmdlet 'Copy-ToAzureMachines'.
Importing cmdlet 'Remove-Environment'.
Importing cmdlet 'Remove-EnvironmentResources'.
Importing cmdlet 'Complete-EnvironmentOperation'.
Importing cmdlet 'Complete-EnvironmentResourceOperation'.
Importing cmdlet 'Complete-ResourceOperation'.
Importing cmdlet 'Get-Environment'.
Importing cmdlet 'Get-EnvironmentProperty'.
Importing cmdlet 'Get-EnvironmentResources'.
Importing cmdlet 'Get-ExternalIpAddress'.
Importing cmdlet 'Get-ParsedSessionVariables'.
Importing cmdlet 'Get-ProviderData'.
Importing cmdlet 'Invoke-EnvironmentOperation'.
Importing cmdlet 'Invoke-ResourceOperation'.
Importing cmdlet 'Invoke-PsOnRemote'.
Importing cmdlet 'New-OperationLog'.
Importing cmdlet 'Copy-FilesToRemote'.
Importing cmdlet 'Register-Environment'.
Importing cmdlet 'Register-EnvironmentDefinition'.
Importing cmdlet 'Register-Provider'.
Importing cmdlet 'Register-ProviderData'.
Importing cmdlet 'Invoke-UnblockEnvironment'.
Importing cmdlet 'Add-TaskIssue'.
Importing cmdlet 'Complete-Task'.
Importing cmdlet 'Find-Files'.
Importing cmdlet 'Get-LocalizedString'.
Importing cmdlet 'Set-TaskProgress'.
Importing cmdlet 'Set-TaskVariable'.
Importing cmdlet 'Write-TaskDetail'.
Importing cmdlet 'Enable-CodeCoverage'.
Importing cmdlet 'Publish-CodeCoverage'.
Exporting cmdlet 'Enable-CodeCoverage'.
Exporting cmdlet 'Publish-CodeCoverage'.
Importing cmdlet 'Enable-CodeCoverage'.
Importing cmdlet 'Publish-CodeCoverage'.
Invoke - Get-TaskVariable cmdlet
Pattern found in solution parameter. Calling Find-Files.
Calling Find-Files with pattern: Dev\**\*.Tests.dll;-:**\obj\**
FindFiles.FindMatchingFiles(rootFolder = C:\Build Agent\_work\1\s, matchPattern = Dev\**\*.Tests.dll;-:**\obj\**, includeFiles = True, includeFolders = False
FindFiles.GetMatchingItems(includePatterns.Count = 1, excludePatterns.Count = 1, includeFiles = True, includeFolders = False
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\ACOFI\Core.ACOFI.Tests\bin\Test\Core.Tests.dll
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\CLeX\Core.CLeX.Tests\bin\Test\Core.CLeX.Tests.dll
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\Framework\Core.Tests\bin\Test\Core.Tests.dll
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.CLeX.Tests.dll
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Tests.dll
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Workflow.Tests.dll
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\Utilities\Core.Utilities.Tests\bin\Test\Core.Utilities.Tests.dll
FindFiles.GetMatchingItems - Found: C:\Build Agent\_work\1\s\Dev\Workflow\Core.Workflow.Tests\bin\Test\Core.Workflow.Tests.dll
FindFiles.FindMatchingFiles - Found 8 matches
Found files: C:\Build Agent\_work\1\s\Dev\ACOFI\Core.ACOFI.Tests\bin\Test\Core.Tests.dll C:\Build Agent\_work\1\s\Dev\CLeX\Core.CLeX.Tests\bin\Test\Core.CLeX.Tests.dll C:\Build Agent\_work\1\s\Dev\Framework\Core.Tests\bin\Test\Core.Tests.dll C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.CLeX.Tests.dll C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Tests.dll C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Workflow.Tests.dll C:\Build Agent\_work\1\s\Dev\Utilities\Core.Utilities.Tests\bin\Test\Core.Utilities.Tests.dll C:\Build Agent\_work\1\s\Dev\Workflow\Core.Workflow.Tests\bin\Test\Core.Workflow.Tests.dll
Calling Invoke-VSTest for all test assemblies
User has chosen vs version
Invoke - Get-TaskVariable cmdlet
Invoke - Get-TaskVariable cmdlet
Test results directory: C:\Build Agent\_work\1\s\TestResults
Testing container: 'REGISTRY::HKEY_CLASSES_ROOT\CLSID\{177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D}'
Exists.
Adding Visual Studio setup helpers.
Getting Visual Studio setup instances.
Found 1 instances.
Description   : Microsoft DevOps solution for productivity and coordination 
                across teams of any size
DisplayName   : Visual Studio Enterprise 2017
Id            : 92fb59b7
InstallDate   : System.Runtime.InteropServices.ComTypes.FILETIME
Name          : VisualStudio/15.2.0+26430.15
Path          : C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
Version       : 15.0.26430.15
VersionString : 15.0.26430.15
Testing leaf: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe'
Exists.
Working folder: C:\Build Agent\_work\1\s
Executing C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "C:\Build Agent\_work\1\s\Dev\ACOFI\Core.ACOFI.Tests\bin\Test\Core.Tests.dll" "C:\Build Agent\_work\1\s\Dev\CLeX\Core.CLeX.Tests\bin\Test\Core.CLeX.Tests.dll" "C:\Build Agent\_work\1\s\Dev\Framework\Core.Tests\bin\Test\Core.Tests.dll" "C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.CLeX.Tests.dll" "C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Tests.dll" "C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Workflow.Tests.dll" "C:\Build Agent\_work\1\s\Dev\Utilities\Core.Utilities.Tests\bin\Test\Core.Utilities.Tests.dll" "C:\Build Agent\_work\1\s\Dev\Workflow\Core.Workflow.Tests\bin\Test\Core.Workflow.Tests.dll"  /diag:C:\Build Agent\_work\_temp\tmp56E8.tmp /logger:trx
Entering ProcessWrapper.CreateStartInfo
workingFolder = C:\Build Agent\_work\1\s
filename = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
arguments = "C:\Build Agent\_work\1\s\Dev\ACOFI\Core.ACOFI.Tests\bin\Test\Core.Tests.dll" "C:\Build Agent\_work\1\s\Dev\CLeX\Core.CLeX.Tests\bin\Test\Core.CLeX.Tests.dll" "C:\Build Agent\_work\1\s\Dev\Framework\Core.Tests\bin\Test\Core.Tests.dll" "C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.CLeX.Tests.dll" "C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Tests.dll" "C:\Build Agent\_work\1\s\Dev\TestRunner\bin\Test\Core.Workflow.Tests.dll" "C:\Build Agent\_work\1\s\Dev\Utilities\Core.Utilities.Tests\bin\Test\Core.Utilities.Tests.dll" "C:\Build Agent\_work\1\s\Dev\Workflow\Core.Workflow.Tests\bin\Test\Core.Workflow.Tests.dll" /diag:C:\Build Agent\_work\_temp\tmp56E8.tmp /logger:trx
Leaving ProcessWrapper.CreateStartInfo
ProcessWrapper.Start - enter
ProcessWrapper.Start - starting process
ProcessWrapper.Start - process started
ProcessWrapper.Start - leave
Microsoft (R) Test Execution Command Line Tool Version 15.0.26228.0
Copyright (c) Microsoft Corporation.  All rights reserved.
Error: The test source file "Agent\_work\_temp\tmp56E8.tmp" provided was not found.
Error: The /Diag parameter requires a file to be provided to write the logs.
Usage:
vstest.console.exe [TestFileNames] /Diag:%temp%\testlog.txt
Processed: ##vso[task.uploadfile]C:\Build Agent\_work\_temp\tmp56E8.tmp
Processed: ##vso[task.logissue type=error;TaskName=VSTest;code=VSTest Test Run failed with exit code1]
System.Exception: VSTest Test Run failed with exit code: 1
Processed: ##vso[task.logissue type=error;]System.Exception: VSTest Test Run failed with exit code: 1
FindFiles.FindMatchingFiles(rootFolder = C:\Build Agent\_work\1\s\TestResults, matchPattern = *.trx, includeFiles = True, includeFolders = False
FindFiles.GetMatchingItems(includePatterns.Count = 1, excludePatterns.Count = 0, includeFiles = True, includeFolders = False
FindFiles.FindMatchingFiles - Found 0 matches
Processed: ##vso[task.logissue type=warning;code=002003;]
No results found to publish.
Processed: ##vso[task.logissue type=warning]No results found to publish.
Leaving script VSTest.ps1
PowerShell script completed with 1 errors.
******************************************************************************
Finishing: Execute Tests (Dev)
******************************************************************************
Evaluating condition for step: 'Post Job Cleanup'
Always run post-job step: 'Post Job Cleanup'
******************************************************************************
Starting: Post Job Cleanup
******************************************************************************
******************************************************************************
Finishing: Post Job Cleanup
******************************************************************************
Cleaning agent temp folder: C:\Build Agent\_work\_temp
******************************************************************************
Finishing: Build
******************************************************************************
vimegh commented 7 years ago

@TehWardy Thanks for sharing detailed logs. Its failing because of a bug at our end, where file for /Diag parameter passed to vstest.console.exe is not provided within double quotes in order to take care of any spaces that might exist in the filepath or name.

You can try following:

  1. Set system.debug= false in variables of your definition, save and then run, this will disable passing of Diag parameter and hence should resolve your problem
  2. If it doesn't solve the problem, then can you please try to setup build agent in a folder whose path/name doesn't contiain any spaces. i.e try setting up Build agent in "C:/BuildAgent/" folder instead of "C:/Build Agent" folder.

Also, as an alternative you should move to VSTest version 2 task, as the same is recommended going forward.

TehWardy commented 7 years ago

Ah ok that fixes the temp file exception in the log above :) So now both my new build servers are showing the same exception.

The step runs fine it seems but it doesn't like my unit tests which depend on some external code (from nuget). It's saying (example, there are a few tests failing for this same reason) ....

Error Message:
Test method Core.Utilities.Tests.DiscountSchemeTests.FixedRateFloatingRate_DiscountApplied_DiscountEqualsBothApplied threw exception:
NCalc.EvaluationException: Type 'System.Diagnostics.TraceEventCache' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Stack Trace:
at NCalc.Expression.Evaluate()
at Core.Utilities.Services.DiscountSchemeService.CalculateDiscount(Decimal faceValue, DiscountParameters p, DiscountRequest req) in C:\BuildAgent\_work\1\s\Dev\Utilities\Core.Utilities\Services\DiscountSchemeService.cs:line 223
at Core.Utilities.Tests.DiscountSchemeTests.TestableDiscountSchemeService.CalculateDiscount(Decimal faceValue, DiscountParameters p, DiscountRequest req) in C:\BuildAgent\_work\1\s\Dev\Utilities\Core.Utilities.Tests\DiscountSchemeTests.cs:line 35
at Core.Utilities.Tests.DiscountSchemeTests.FixedRateFloatingRate_DiscountApplied_DiscountEqualsBothApplied() in C:\BuildAgent\_work\1\s\Dev\Utilities\Core.Utilities.Tests\DiscountSchemeTests.cs:line 421
Failed   OnlyFixedRate_DiscountApplied_DiscountEqualsFixedRate

They all seem to raise the same exception ...

NCalc.EvaluationException: Type 'System.Diagnostics.TraceEventCache' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

This doesn't happen locally or on the old build box. The build process is otherwise fine though.

Gut feeling this is something to do with the third party lib but it's odd that the build process gets this issue when it doesn't happen locally don't you think?

TehWardy commented 7 years ago

Since the nCalc library is no longer supported (at least I think that's the case as the last commit was like 5 years ago) i'm going to go with "problem solved" and close this ticket and just comment out those "legacy code based unit tests" with a plan to remove / replace the code already in place.

Thanks for the help @vimegh

tasharm commented 5 years ago

I am getting a similar error but don't have any spaces in the path. moreover I can see the dll getting copied in the drop step before running the tests.

error : The test source file "dll_path>> provided was not found