diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f05d90..8ad998c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/package-lock.json b/package-lock.json index a25898d..9728a15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mono-debug", - "version": "0.16.1", + "version": "0.16.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c827bac..3a56001 100644 --- a/package.json +++ b/package.json @@ -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", @@ -179,6 +179,11 @@ }, "default": [] }, + "passDebugOptionsViaEnvironmentVariable": { + "type": "boolean", + "description": "%mono.launch.passDebugOptionsViaEnvironmentVariable.description%", + "default": false + }, "env": { "type": "object", "description": "%mono.launch.env.description%", diff --git a/package.nls.json b/package.nls.json index bc86268..c03cc84 100644 --- a/package.nls.json +++ b/package.nls.json @@ -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.", diff --git a/src/csharp/MonoDebugSession.cs b/src/csharp/MonoDebugSession.cs index c15b313..57f451c 100644 --- a/src/csharp/MonoDebugSession.cs +++ b/src/csharp/MonoDebugSession.cs @@ -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) {