Skip to content

[BUG]: VSTest task: Unexpected end of JSON input #20863

Open
@bradselw

Description

New issue checklist

Task name

VSTest

Task version

3.246.0

Issue Description

The VSTest task intermittently fails with the following error message:

##[error]Unhandled: Unexpected end of JSON input
##[error]SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at module.exports.vbsOutputTransform [as _transform] (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\regedit\lib\helper.js:51:18)
    at Transform._read (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at Transform._write (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_writable.js:227:5)
    at Writable.write (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_writable.js:194:11)
    at StreamSlicer.ondata (node:internal/streams/readable:1007:22)
    at StreamSlicer.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
##[error]Unhandled: Command failed: cscript.exe //Nologo C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\regedit\vbs\regListStream.wsf A

##[error]Error: Command failed: cscript.exe //Nologo C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\regedit\vbs\regListStream.wsf A

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:339:12)

We see this happen in our pipelines about 100 times a week, starting around 3-4 months ago.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows

Relevant log output

2025-02-18T18:48:08.1715302Z ##[section]Starting: Run Tests
2025-02-18T18:48:08.1865669Z ==============================================================================
2025-02-18T18:48:08.1866370Z Task         : Visual Studio Test
2025-02-18T18:48:08.1866711Z Description  : Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2 and later).
2025-02-18T18:48:08.1867618Z Version      : 3.246.1
2025-02-18T18:48:08.1867940Z Author       : Microsoft Corporation
2025-02-18T18:48:08.1868256Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/vstest
2025-02-18T18:48:08.1868622Z ==============================================================================
2025-02-18T18:48:10.3820094Z Running tests using vstest.console.exe runner.
2025-02-18T18:48:10.3821580Z ======================================================
2025-02-18T18:48:10.3824860Z Test selector : Test assemblies
2025-02-18T18:48:10.3826737Z Test filter criteria : (TestCategory=OfficialDDRIT | FullyQualifiedName~microsoft.visualstudio.xaml.ddrit) & FullyQualifiedName!~CreateProjectTest
2025-02-18T18:48:10.3828458Z Search folder : C:\Test\Containers
2025-02-18T18:48:10.4632233Z Action when minimum tests threshold not met : donothing
2025-02-18T18:48:10.4633303Z Minimum tests expected to be run: 0
2025-02-18T18:48:10.7402729Z Run settings file : C:\Test\DDRITs.runsettings
2025-02-18T18:48:10.7407888Z Run in parallel : false
2025-02-18T18:48:10.7409325Z Run in isolation : false
2025-02-18T18:48:10.7410735Z Path to custom adapters : undefined
2025-02-18T18:48:10.7414515Z Other console options : undefined
2025-02-18T18:48:10.7416218Z Code coverage enabled : false
2025-02-18T18:48:10.7418482Z Diagnostics enabled : false
2025-02-18T18:48:10.7422320Z Rerun failed tests: true
2025-02-18T18:48:10.7424499Z Rerun failed tests threshold: 30
2025-02-18T18:48:10.7425881Z Rerun maximum attempts: 1
2025-02-18T18:48:10.7448432Z Run the tests locally using vstest.console.exe
2025-02-18T18:48:10.7449219Z ========================================================
2025-02-18T18:48:10.7451447Z Source filter: VC.Tests.IDE\VC.Tests.IDE.dll
2025-02-18T18:48:10.8321564Z ======================================================
2025-02-18T18:48:10.9012921Z [command]C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\Modules\DTAExecutionHost.exe --inputFile C:\DartLab\Agent\_work\_temp\input_e69fce70-ee28-11ef-8bd9-113706f8411a.json
2025-02-18T18:48:11.1788869Z ##[error]Unhandled: Unexpected end of JSON input
2025-02-18T18:48:11.1825170Z ##[error]SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at module.exports.vbsOutputTransform [as _transform] (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\regedit\lib\helper.js:51:18)
    at Transform._read (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at Transform._write (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_writable.js:227:5)
    at Writable.write (C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\readable-stream\lib\_stream_writable.js:194:11)
    at StreamSlicer.ondata (node:internal/streams/readable:1007:22)
    at StreamSlicer.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
2025-02-18T18:48:11.1856178Z ##[error]Unhandled: Command failed: cscript.exe //Nologo C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\regedit\vbs\regListStream.wsf A

2025-02-18T18:48:11.1866805Z ##[error]Error: Command failed: cscript.exe //Nologo C:\DartLab\Agent\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\3.246.1\node_modules\regedit\vbs\regListStream.wsf A

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:339:12)
2025-02-18T18:48:11.5639051Z ##########################################################################
2025-02-18T18:48:11.5652217Z DtaExecutionHost version 19.240.34919.1.
2025-02-18T18:48:12.9180605Z Starting TestExecution Model...
2025-02-18T18:48:15.2611057Z Result Attachments will be stored in LogStore
2025-02-18T18:48:15.3427651Z Run Attachments will be stored in LogStore
2025-02-18T18:48:15.3930699Z Result Attachments will be stored in LogStore
2025-02-18T18:48:15.4946392Z Result Attachments will be stored in LogStore
2025-02-18T18:48:15.4955205Z Run Attachments will be stored in LogStore
2025-02-18T18:48:15.5685055Z Provided settings file:
<I have omitted the rest of the log in case it contains sensitive information>

Full task logs with system.debug enabled

 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

The issue is intermittent, which makes reproing it manually difficult. It happens about 100 times a week, however. We have telemetry that makes it trivial to obtain repros in production. Please reach out to me for the query, I work at Microsoft on the Visual Studio Engineering team.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions