question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Environment variables in launch.json is not processing ${auto-detect-url}

See original GitHub issue

From @corretge on November 29, 2017 8:49

When I try to put a launch variable in launch.json

            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "ENV_GLOBAL_CURRENT_URL" : "${auto-detect-url}"
            }

I get this value:

"${auto-detect-url}"

instead

"http://localhost:5000"
  • VSCode Version: 1.18.1
  • OS Version: Windows 10

Steps to Reproduce:

  1. Create a C# project
  2. Set environment variables for a debug configuration as explained at begin
  3. Add Environment.GetEnvironmentVariable(“ENV_GLOBAL_CURRENT_URL”)
  4. Debug until this instruction

Copied from original issue: Microsoft/vscode#39294

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gregg-miskellycommented, Jan 8, 2018

Thanks @corretge, this isn’t something that is possible. The debugger doesn’t know the value of ${auto-detect-url} – it watches your application run, and when it outputs the right message to stdout we grab it and start a browser. It is actually your application that does know this value. I am afraid I am not enough of an ASP.NET Core expert to tell you exactly where the framework is reading the URL from, but you could read the URL from whatever configuration file ASP.NET is getting it from.

0reactions
corretgecommented, Jan 8, 2018

I want to know this value in my application, and my first approach was to set as an environment variable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment variables in launch.json is not processing ${auto ...
When I try to put a launch variable in launch.json "env": ... is not processing ${auto-detect-url} OmniSharp/omnisharp-vscode#1933.
Read more >
How do I add environment variables to launch.json in VSCode
You can add env variables by using the env property in your launch.json file or by using the envFile property with the value...
Read more >
Debugging in Visual Studio Code
VS Code will try to automatically detect your debug environment, but if this fails, you will have to choose it manually: debug environment...
Read more >
launchSettings.json - Visual Studio for Mac - Microsoft Learn
In this article. Update the start configuration by using Visual Studio for Mac; Configure environment variables; Configure the start URL.
Read more >
VS Code | Build, Run and Debug in C++ - GeeksforGeeks
json file. cwd: denotes current working directory. Note that all the addresses in launch.json file are in general form, they are not specific...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found