Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coreclr debug configuration should support input variables for envFile #5102

Closed
karolz-ms opened this issue Mar 9, 2022 · 6 comments · Fixed by #5189
Closed

coreclr debug configuration should support input variables for envFile #5102

karolz-ms opened this issue Mar 9, 2022 · 6 comments · Fixed by #5189

Comments

@karolz-ms
Copy link
Member

VS Code has a mechanism called "input variables" where debug configuration values can be resolved by running arbitrary commands, picking an item from predefined list, or prompting the user: https://code.visualstudio.com/docs/editor/variables-reference#_input-variables

Node.js and Python debug configuration providers support this mechanism. Unfortunately, coreclr seems to lack this support.

Repro steps

  1. Create a debug configuration that uses an input variable, for example
{
    "configurations": [
        {
            "name": "Debug API",
            "type": "coreclr",
            "request": "launch",
            // other properties as necessary
            "envFile": "${input:getPathToFile}"
        }
    ],
    "inputs": [
        {
            "id": "getPathToFile",
            "type": "promptString"
             // The really interesting/important case is type==command.
             // promptString is used just to simplify the repro
         }
    ]
}
  1. Try using the configuration

Expected result

Should prompt the user for the path to the .env file

Actual result

Can't parse envFile ${input:getPathToFile} because of Error: ENOENT: no such file or directory, open '${input:getPathToFile}'
@gregg-miskelly
Copy link
Contributor

The C# extension does support 'inputs', except for envFile. I am not sure if it would be possible for envFile to support inputs or not -- we handle envFile in our configuration resolver, which runs before inputs are completed. I don't know if we can push it to a later stage.

@gregg-miskelly gregg-miskelly changed the title coreclr debug configuration should support input variables coreclr debug configuration should support input variables for envFile Mar 9, 2022
@karolz-ms
Copy link
Member Author

Well, Node and Python do support input variables for envFile, so maybe C# can do that too.

Maybe @connor4312 can help by explaining how it is done, or point us to relevant code in JS debugger extension?

@gregg-miskelly
Copy link
Contributor

I don't think how it is done in the JS debugger will be relevant -- we could make this work by reimplementing envFile natively in our debug adapter. But if there isn't a good way to solve this without doing that I think we would probably just "Won't Fix" this bug.

@connor4312
Copy link

js-debug handles it at launch time, but you could also change this extension to resolve envFile after variables are substituted via the relatively-new post-substitution method in the resolver.

@karolz-ms
Copy link
Member Author

@gregg-miskelly we came to the point in our schedule where we will need this, so I am going to try to come up with a PR if that is OK with you

@gregg-miskelly
Copy link
Contributor

@karolz-ms Sounds great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants