diff --git a/Python/Product/PythonTools/PythonTools/Debugger/DebugAdapter/DebugAdapterLauncher.cs b/Python/Product/PythonTools/PythonTools/Debugger/DebugAdapter/DebugAdapterLauncher.cs index 387992ff66..1a9c7a7ab5 100644 --- a/Python/Product/PythonTools/PythonTools/Debugger/DebugAdapter/DebugAdapterLauncher.cs +++ b/Python/Product/PythonTools/PythonTools/Debugger/DebugAdapter/DebugAdapterLauncher.cs @@ -203,12 +203,16 @@ public sealed class DebugAdapterLauncher : IAdapterLauncher { launchJson.DebugStdLib = debugService.DebugStdLib; launchJson.ShowReturnValue = debugService.ShowFunctionReturnValue; - try { - var adapterLaunchInfoJson = JObject.Parse(adapterLaunchInfo.LaunchJson); - AddVariablePresentationOptions(adapterLaunchInfoJson, launchJson); - } catch (JsonReaderException) { - // this should never happen - Debug.Fail("adapterLaunchInfo is not valid json"); + // adapterLaunchInfo.LaunchJson can be null when attaching to a remote process + if (adapterLaunchInfo.LaunchJson != null) { + + try { + var adapterLaunchInfoJson = JObject.Parse(adapterLaunchInfo.LaunchJson); + AddVariablePresentationOptions(adapterLaunchInfoJson, launchJson); + } catch (JsonReaderException) { + // this should never happen + Debug.Fail("adapterLaunchInfo is not valid json"); + } } var excludePTVSInstallDirectory = new PathRule() {