Skip to content

How do I forward command line arguments when debugging into a dotnet console program? #4256

Answered by bwateratmsft
Amplus asked this question in Q&A
Discussion options

You must be logged in to vote

For debugging, we don't actually launch the entrypoint--we start the container with a do-nothing command so it stays up but isn't doing anything. From there, we start VSDBG, and instruct VSDBG to start your app. This way, you can debug startup code.

Consequently, to get command line arguments to your app, you have to instruct VSDBG to do it, which can be done in .vscode/launch.json by adding properties like this to the "Docker .NET Launch" configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Docker .NET Launch",
            "type": "docker",
            "request": "launch",
            "preLaunchTask": "docker-run: debug",
            "netCore": {

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Amplus
Comment options

Answer selected by Amplus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants