Closed dfdumaresq closed 2 years ago
What does your existing environment look like? You should be able to pass your environment variables using the args
parameter as shown in the example launch.json
(all variables passed there are passed to the underlying dotnet debugger :))
Awesome! I see my mistake - you are adding env within args. We add it without. I can now add env without any trouble. However, my breakpoints become unbound once I start up the web client. I'll spend more time on it later next week. Thanks for your quick reply! launch.json
{
"type": "dotnetwatchattach",
"request": "launch",
"name": ".NET Watch Attach",
"args": { // Args to pass to coreclr attach
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"API_BASE_URL_PRIV": "https://api.***",
"APIS_BASE_URL_PRIV": "https://apis.***",
"EPBC_API_TOKEN": "token",
"EPBC_API_UPLOAD_URI": "https://apis.***",
"EPBC_API_UPLOAD_TOKEN": "another token",
"EPBC_STS_URI": "http://localhost:5003",
"X509_SIGNING_CREDENTIAL_PASSWORD": "***",
"EPBC_APPLY_URI": "https://localhost:54430",
"APPL_TOKEN": "token",
"REDIS_HOST": "127.0.0.1:6379,abortConnect=false",
"LOCAL_CERT_PFX_PATH": "/usr/local/etc/certs/localhost.pfx",
}
},
"task": "watch", // Label of watch task in tasks.json
"program": "${workspaceFolder}/bin/Debug/net6.0/EPBC.PSAS.dll",
},
tasks.json
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/EPBC.PSAS.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
The program
parameter in your launch.json
is invalid. It should be the name of the process, including the .exe
. I am guessing that for your project it would be EPBC-PSAS.exe
although you can check the process name in task manager.
You could also configure your environment settings on task level, see the docs - options.env
Have a great weekend!
Closing this due to inactivity
Sorry - it's taken so long to get back to you. I should point out, I'm on a Mac so we are not using .exe programs. The program EPBC.PSAS.dll is running after launching dotnetwatchattach. I have verified this by starting dotnetwatchattach with program commented out, which gives the error. "Cannot find a program to debug". However, with program not commented out and dotnetwatchattach running, my breakpoints become unbound.
We use launch.json to run dotnet against API's from different environments. So please see if you can implement the env: {} paramenter. It is not allowed in your current implementation.
This will be very helpful!
Thanks, Dave