Scenario: I have developed a custom build task for Azure DevOps.
- This task requires an input parameter, param1
- The task is created using VS Code (v1.30.1) and TypeScript (tsc --version state: v3.2.2)
Issue During debugging of the task, I am unable to provide variable values for param1. Breakpoints are being triggered which indicates that the debugging process is functioning correctly.
Snippet of Code: index.ts
import tl = require('azure-pipelines-task-lib/task');
async function run() {
try {
let param1: string = tl.getInput('param1', true);
if (param1 === null || param1 === undefined) {
console.log('Should not be here...');
}
}
catch (err) {
tl.setResult(tl.TaskResult.Failed, err.message);
}
}
run();
The code runs successfully when executed from the console using tsc;node index.js. However, when trying to debug with the VS Code debugger, I encounter difficulties in passing a value to param1, resulting in a crash within the 'getInput' method.
My launch.json configuration:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "TaskName",
"program": "${workspaceFolder}/Extensions\\BuildTasks\\TaskName\\index.ts",
"outFiles": [
"${workspaceFolder}/Extensions\\BuildTasks\\TaskName\\**\\*.js"
]
}
]}
I also attempted to add
"env": {
"param1": "thisBeString"
}
under the output files section, but it did not yield desired results.
In further attempts, I tried utilizing
"args": {
"--param1": "thisBeString"
}
which also led to failure.
Additionally, I experimented with inputs in my tasks.json without success as mentioned in this SO Q&A (link)
Hence, my question arises: How can I pass in variable values while debugging Azure DevOps extensions in VS Code?