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

Fix issue 5102 #5189

Merged
merged 3 commits into from
Apr 27, 2022
Merged

Fix issue 5102 #5189

merged 3 commits into from
Apr 27, 2022

Conversation

karolz-ms
Copy link
Member

Resolves #5102

@karolz-ms
Copy link
Member Author

Test configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            // Use IntelliSense to find out which attributes exist for C# debugging
            // Use hover for the description of the existing attributes
            // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/bin/Debug/net6.0/hellocsharp.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false,
            "envFile": "${input:getPathToFile}"
        },

        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach"
        }
    ],

    "inputs": [
        {
            "id": "getPathToFile",
            "description": "Choose environment file",
            "type": "pickString",
            "options": [
                "${workspaceFolder}/richard.env",
                "${workspaceFolder}/john.env"
            ]
        }
    ]
}

Program:

while (true) {
    var ufn = System.Environment.GetEnvironmentVariable("USER_FIRST_NAME");
    if (ufn != null) {
        Console.WriteLine($"Hello, {ufn}! Tell me how you're doing?");
    } else {
        Console.WriteLine("Hello, World! Tell me how you're doing?");
    }
    Thread.Sleep(TimeSpan.FromSeconds(3));
}

Copy link
Contributor

@gregg-miskelly gregg-miskelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

src/configurationProvider.ts Show resolved Hide resolved
@gregg-miskelly
Copy link
Contributor

gregg-miskelly commented Apr 27, 2022

One thing to verify: if you debug multiple times, will VS Code always open the debug console on startup? I want to verify VS Code still respects internalConsoleOptions if it is added this way.

@karolz-ms
Copy link
Member Author

One thing to verify: if you debug multiple times, will VS Code always open the debug console on startup? I want to verify VS Code still respects internalConsoleOptions if it is added this way.

Yes, during my testing VS Code always opens Debug Console when debugging is started, even if I manually close it between debug sessions.

@gregg-miskelly gregg-miskelly enabled auto-merge (squash) April 27, 2022 20:47
@gregg-miskelly gregg-miskelly merged commit 7b1f541 into dotnet:master Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coreclr debug configuration should support input variables for envFile
2 participants