azure-pipelines-tasks: NullReference exception while publishing test results

Steps to reproduce

This doesn’t happen all the time, it’s on and off, although recently it seems to be happening more often than before. Our CI pipeline in DevOps fails at the test stage. The test run is successful and when test results are published the vstest app crashes with a null reference exception.

Captured diagnostics and full debug log from the Azure DevOps console and attached to this email alongside the output trx.

Considering the fact that is not always failing i’m just wondering if it’s a timing issue whereby the trx is not yet flushed to the disk before it tries to read it?

Error stack trace

Error occurred while publishing test results : System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at Microsoft.TeamFoundation.TestClient.PublishTestResults.TrxResultParser.<>c__DisplayClass16_0.<ReadActualResults>b__1(String xunitParentNodeKey)
    at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
    at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
    at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )
    --- End of inner exception stack trace ---
    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
    at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
    at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
    at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body)
    at Microsoft.TeamFoundation.TestClient.PublishTestResults.TrxResultParser.ReadActualResults(XmlNodeList resultsNodes, TestType testType, Dictionary`2 xUnitTestCaseCounts)
    at Microsoft.TeamFoundation.TestClient.PublishTestResults.TrxResultParser.ParseTestResultFile(TestRunContext runContext, String filePath)
    at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    at Microsoft.TeamFoundation.TestClient.PublishTestResults.TrxResultParser.ParseTestResultFiles(TestRunContext runContext, IList`1 resultFilePaths)
    at Microsoft.VisualStudio.TestService.TcmTestResultPublisher.TrxTestResultPublisher.ParseTrx(TestRunContext testRunContext, IList`1 trxFilePaths)
    at Microsoft.VisualStudio.TestService.TcmTestResultPublisher.TrxTestResultPublisher.PublishTestRunResults(TestRunModel testRunModel)
    at MS.VS.TestService.VstestConsoleAdapter.PublishTestResult.CreateOrUpdateTestRun(TestRunModel testRunModel)
    at MS.VS.TestService.VstestConsoleAdapter.PublishTestResult.Publish(VstestConsoleRunContext testRunContext)
    ---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
    at Microsoft.TeamFoundation.TestClient.PublishTestResults.TrxResultParser.<>c__DisplayClass16_0.<ReadActualResults>b__1(String xunitParentNodeKey)
    at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
    at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
    at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<---

Attachments

github-issue.zip logs.txt

Operating system, Build version of vstest.console OS: Windows (Windows Server 2016 Datacenter) VSTest: 16.5.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Just an update…tried moving back to 16.4.0 and it seems to be better, so it feels like this issue is tied to 16.5.0 version of the test platform.