azure-pipelines-tasks: Visual Studio Test task fails with System.IO.FileNotFoundException on temp file when run Impacted tests is enabled.

Type: Bug

Task Name: Visual Studio Test

Environment

  • Server - Azure Pipelines

  • Agent - Hosted:

    • OS: Windows Server 2016 Standard

    • Visual Studio Version: 2019

    • Agent Version: 2.155.1

Issue Description

The task has started failing every time it runs. It started failing when the pipeline auto-updated the task from version 2.159.1 to version 2.160.2.

The log for this task shows it failing with a System.IO.FileNotFoundException:

Task logs

logs_15713.zip

Error logs

##[error]Error occured while executing System.IO.FileNotFoundException: Could not find file 'E:\agentG2\_work\_temp\m0umztbldww.tmp'. File name: 'E:\agentG2\_work\_temp\m0umztbldww.tmp' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding) at System.IO.File.InternalReadAllLines(String path, Encoding encoding) at MS.VS.TestService.VstestConsoleAdapter.TestSelectorCommandInputs.GetTestsList(String listTestsFile) at MS.VS.TestService.VstestConsoleAdapter.TestSelectorCommandInputs.GetImpactedTestsCommandInput(VstestConsoleRunContext testRunContext) at MS.VS.TestService.VstestConsoleAdapter.ExecutionStateResolver.GetNextPhase(VstestConsoleRunContext consoleRunContext, ITestRunPhase currentPhase, ITestRunPhaseResults phaseResult) Completed TestExecution Model... ##[warning]Vstest failed with error. Check logs for failures. There might be failed tests. ##[error]Error: The process 'E:\agentG2\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.160.2\Modules\DTAExecutionHost.exe' failed with exit code 1 ##[error]Vstest failed with error. Check logs for failures. There might be failed tests. ##[section]Finishing: VsTest - testAssemblies x86

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Running into the same error. I have 6 test tasks in a pipeline and this was happening to two of them - the ones that had “Run only impacted tests” checked. Unchecked that and now the test tasks don’t error out.

I gave it a go and can confirm v2.160.4 works as expected while looking for impacted tests again :

***************************** Section 'Get Impacted Tests' Starting *****************************
V, 2019/11/20, 15:06:05.737, PERF: CreateTestRun: took 153.1381 ms
V, 2019/11/20, 15:06:05.737, PERF WARNING: CreateTestRun: took 153.1381 ms
V, 2019/11/20, 15:06:05.737, Tests that are discovered.

...

V, 2019/11/20, 15:06:07.018, Published Test Run : 1013592
***************************** Section 'Update test results' Ended ********************************

We have faced the same issue, since the auto-upgrade from 2.159.1 to 2.160.2. We have found the reason: the generated .runsettings file by the task uses single ‘\’ instead of ‘\\’. See attached files.

Using the settings file with ‘\\’ solved the issue for us.

runsettings_2.159.1.runsettings.txt runsettings_2.160.2.runsettings.txt

We are facing the same issue, since the auto-upgrade from 2.159.1 to 2.160.2. We are getting System.IO.FileLoadException loading our CLI/C++ assemblies from C# test projects.

We have this problem too, only since today… Task is 2.160.2 but i can’t be sure about the previous version.

We never had any issue with the checked option “Run only impacted tests” before today.

The temporary workaround will do but a quick fix or rollback would be great!

Running into the same error. I have 6 test tasks in a pipeline and this was happening to two of them - the ones that had “Run only impacted tests” checked. Unchecked that and now the test tasks don’t error out.

I tried unchecking that box on my test task…and my pipeline runs OK. That is a good enough workaround for me. Thanks for providing the suggestion.