Skip to content

Commit

Permalink
Don't use MONO_ENV_OPTIONS to pass debug options by default
Browse files Browse the repository at this point in the history
It causes issues when starting subprocesses.
Fixes #68
  • Loading branch information
akoeplinger committed Oct 9, 2020
1 parent 12b636c commit 488eff1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.16.2

* Don't use MONO_ENV_OPTIONS to pass debug options by default, it causes issues when starting subprocesses: [Issue #68](https://github.com/microsoft/vscode-mono-debug/issues/68)

## 0.16.1

* Support debugging VB source files (.vb)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mono-debug",
"displayName": "Mono Debug",
"version": "0.16.1",
"version": "0.16.2",
"publisher": "ms-vscode",
"description": "Visual Studio Code debugger extension for Mono",
"icon": "images/mono-debug-icon.png",
Expand Down Expand Up @@ -179,6 +179,11 @@
},
"default": []
},
"passDebugOptionsViaEnvironmentVariable": {
"type": "boolean",
"description": "%mono.launch.passDebugOptionsViaEnvironmentVariable.description%",
"default": false
},
"env": {
"type": "object",
"description": "%mono.launch.env.description%",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"mono.launch.cwd.description": "Absolute path to the working directory of the program being debugged.",
"mono.launch.runtimeExecutable.description": "Absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.",
"mono.launch.runtimeArgs.description": "Optional arguments passed to the runtime executable.",
"mono.launch.passDebugOptionsViaEnvironmentVariable.description": "Use the MONO_ENV_OPTIONS environment variable to pass the Mono debugger options when launching a program. This is useful if you're embedding Mono in a custom executable.",
"mono.launch.env.description": "Environment variables passed to the program.",
"mono.launch.externalConsole.deprecationMessage": "Attribute 'externalConsole' is deprecated, use 'console' instead.",
"mono.launch.console.description": "Where to launch the debug target.",
Expand Down
16 changes: 12 additions & 4 deletions src/csharp/MonoDebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,18 @@ public override async void Launch(Response response, dynamic args)
bool debug = !getBool(args, "noDebug", false);

if (debug) {
if (!env.ContainsKey("MONO_ENV_OPTIONS"))
env["MONO_ENV_OPTIONS"] = $" --debug --debugger-agent=transport=dt_socket,server=y,address={host}:{port}";
else
env["MONO_ENV_OPTIONS"] = $" --debug --debugger-agent=transport=dt_socket,server=y,address={host}:{port} " + env["MONO_ENV_OPTIONS"];
bool passDebugOptionsViaEnvironmentVariable = getBool(args, "passDebugOptionsViaEnvironmentVariable", false);

if (passDebugOptionsViaEnvironmentVariable) {
if (!env.ContainsKey("MONO_ENV_OPTIONS"))
env["MONO_ENV_OPTIONS"] = $" --debug --debugger-agent=transport=dt_socket,server=y,address={host}:{port}";
else
env["MONO_ENV_OPTIONS"] = $" --debug --debugger-agent=transport=dt_socket,server=y,address={host}:{port} " + env["MONO_ENV_OPTIONS"];
}
else {
cmdLine.Add("--debug");
cmdLine.Add($"--debugger-agent=transport=dt_socket,server=y,address={host}:{port}");
}
}

if (env.Count == 0) {
Expand Down

0 comments on commit 488eff1

Please sign in to comment.