Cannot use PreLaunchTask with nRF Connect SDK in VSCode

Hi All,

I need to execute a task just before debugging but after flashing in VSCode. I searched it on the net and understood I need to add preLaunchTask in launch.json and the task shall be defined in tasks.json. As suggested I added my task in tasks.json and its reference to launch.json. Here you can see my launch.json. it is very simple...

{
"version": "0.2.0",
"configurations": [
{
"type": "nrf-connect",
"request": "launch",
"name": "Launch build",
"config": "${workspaceFolder}/build",
"preLaunchTask": "queryPythonVersion",
"runToEntryPoint": "main"
}
]
}
And my tasks.json file. 
{
"label": "queryPythonVersion",
"command": "python3 --version",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
I kept it simple. As you see it is just querying the Python version in the shell. 
When I perform debugging (F5), it seems nothing happens. Basically, it ignores the task given in preLaunchTask. I further debugged and implemented preLaunchTask in another project/workspace that doesn't contain nRF Connect SDK, and observed my preLaunchTask was successfully executed before debugging. 
What causes this problem? And, how should I properly implement preLaunchTask with nRF Connect SDK?
Thanks,
Apo
Related