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

Pass env variables from vstest to debugger #5137

Merged
merged 2 commits into from
Apr 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/features/dotnetTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export default class TestManager extends AbstractProvider {
}
}

private _createLaunchConfiguration(program: string, args: string, cwd: string, debuggerEventsPipeName: string) {
private _createLaunchConfiguration(program: string, args: string, cwd: string, environmentVariables: Map<string, string>, debuggerEventsPipeName: string) {
let debugOptions = vscode.workspace.getConfiguration('csharp').get('unitTestDebuggingOptions');

// Get the initial set of options from the workspace setting
Expand All @@ -333,7 +333,8 @@ export default class TestManager extends AbstractProvider {
debuggerEventsPipeName: debuggerEventsPipeName,
program: program,
args: args,
cwd: cwd
cwd: cwd,
env: environmentVariables,
Copy link
Member Author

Choose a reason for hiding this comment

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

@gregg-miskelly please review, I am not sure if I need to do additional merging on the existing result which is a collection of debugger config, over which the new configuration is spread. Can it have env on it already?

Copy link
Contributor

@gregg-miskelly gregg-miskelly Mar 31, 2022

Choose a reason for hiding this comment

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

No, you shouldn't need to. It is not valid according to the schema (see here).

};

// Now fill in the rest of the options
Expand Down Expand Up @@ -369,6 +370,7 @@ export default class TestManager extends AbstractProvider {
response.FileName,
response.Arguments,
response.WorkingDirectory,
response.EnvironmentVariables,
debugEventListener.pipePath());
}
finally {
Expand Down Expand Up @@ -497,7 +499,7 @@ export default class TestManager extends AbstractProvider {

try {
let response = await serverUtils.debugTestClassGetStartInfo(this._server, request);
return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, debugEventListener.pipePath());
return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, response.EnvironmentVariables, debugEventListener.pipePath());
}
finally {
listener.dispose();
Expand Down Expand Up @@ -537,7 +539,7 @@ export default class TestManager extends AbstractProvider {
return null;
}

return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, debugEventListener.pipePath());
return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, response.EnvironmentVariables, debugEventListener.pipePath());
}
finally {
listener.dispose();
Expand Down