profile
viewpoint
Pavel Minaev int19h Microsoft North Bend, WA, USA

int19h/aow-patch 12

Unofficial patch for Age of Wonders

int19h/WarBender 10

WarBender: a Mount & Blade: Warband save game editor

int19h/csx 3

C# scripting for Mount & Blade 2: Bannerlord

int19h/warbend 3

WarBend: a Python library to read and write Mount & Blade: Warband saved games

int19h/cpython 0

The Python programming language

int19h/debugpy 0

An implementation of the Debug Adapter Protocol for Python

int19h/django 0

The Web framework for perfectionists with deadlines.

int19h/FirearmDeathRate 0

Use regression tree to predict firearm death rate with firearm law & CDC firearm death rate data.

int19h/kiwix-tools 0

Command Kiwix tools: kiwix-serve, kiwix-install, kiwix-manage, ...

int19h/mb_warband_module_system 0

Mount & Blade: Warband module system (mirror)

issue commentmicrosoft/PTVS

Unexpeted error InvalidOperationException was happened.

This issue is still repro today. image

linette-zyy

comment created time in 3 hours

issue commentmicrosoft/PTVS

Can't select Python environment

Hi, I also had this issue while trying to open Tools --> Python --> Python Environments on my VS2017 I am using VS2017 Professional version 15.9.30 on Windows 10 I noticed this might be because of my newly installed Anaconda. I remembered not having this issue before that. Thanks,

vsfeedback

comment created time in 6 hours

push eventmicrosoft/PTVS

Adam Yoblick

commit sha c5dccf76cc9b46d5588eac0dcc8d0264ec9f647b

handle case when attaching instead of launching debugger

view details

Adam Yoblick

commit sha 7acd534bc727d100534c7792a2af3e48881c866c

use global options instead of project-specific ones

view details

Adam Yoblick

commit sha 0c213e901168fee368a32939256174077a8d4dfa

Merge pull request #6372 from AdamYoblick/fix_error_when_attaching Use global debug options instead of project-specific ones

view details

push time in 7 hours

PR merged microsoft/PTVS

Reviewers
Use global debug options instead of project-specific ones

Fixes #6369

This is a fix for a regression I introduced when reading variable presentation options from the options page. The bug occurs when attaching to a remote debugpy process instead of launching the debugger directly, which is a case I did not test.

+58 -71

3 comments

6 changed files

AdamYoblick

pr closed time in 7 hours

issue closedmicrosoft/PTVS

Failed to launch debug adapter in romote debugging with debugpy.

Python Environment: image

Steps to Reproduce 1.Typing code in .py and set breakpoint in the code.

input('>')
print('hello')

2.Install "debugpy" in the current python environment. 3.In command prompt(right-click the python environment and select "Open Command Prompt Here…"), execute: python -m debugpy --listen 127.0.0.1:4022 C:\Users\vwazho\source\repos\PythonApplication1\PythonApplication1\PythonApplication1.py 4. Launch VS and Debug > Attach to Process, in dialog: a. Select connection type with Python remote(ptvsd) b. Connection target with 127.0.0.1:4022 c. In Available processes list, select the appropriate python.exe, click "Attach" 5. Type enter in the console 6.Check that it stops at the breakpoint Expected behavior remote attach successfully with no errors

Actual behavior error dialog pop up when attaching. image

closed time in 7 hours

zhouwangyang

pull request commentmicrosoft/PTVS

Use global debug options instead of project-specific ones

Thanks everyone!

AdamYoblick

comment created time in 7 hours

pull request commentmicrosoft/PTVS

Use global debug options instead of project-specific ones

Kudos, SonarCloud Quality Gate passed!

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Bugs
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Vulnerabilities
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Security Hotspots
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Code Smells

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' /> No Coverage information
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo.png' alt='No Duplication information' width='16' height='16' /> No Duplication information

AdamYoblick

comment created time in 7 hours

issue commentmicrosoft/PTVS

Failed to launch debug adapter in romote debugging with debugpy.

My comment was wrong, we definitely can read from the options page. The PR has been updated with the new logic to do so. :)

zhouwangyang

comment created time in 7 hours

pull request commentmicrosoft/PTVS

Use global debug options instead of project-specific ones

Ok this all seems to be working. I tested both when launching the debugger directly through VS as well as attaching to a debugpy process, and both respect the variable presentation options from the Tools -> Options page. So this is ready for review again :)

AdamYoblick

comment created time in 7 hours

Pull request review commentmicrosoft/PTVS

handle case when attaching instead of launching debugger

 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) {

ok thank you everyone, I have a clear path now. Global makes sense to me too, since these options are not project specific. And since they are moving to global in vscode too, I think that's a good approach.

AdamYoblick

comment created time in 8 hours

Pull request review commentmicrosoft/PTVS

handle case when attaching instead of launching debugger

 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) {

The two ways were there to handle project specific and global option. It should be fine to read non-project specific properties directly from global location.

PS: This part is also a bit messy because of the way we had to handle ptvsd4 vs debugpy at the same time.

AdamYoblick

comment created time in 8 hours

Pull request review commentmicrosoft/PTVS

handle case when attaching instead of launching debugger

 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) {

It seems that I can just add some fields to the IPythonDebugOptionsService to expose the variable presentation stuff that already exists on the DebuggerOptions class. But this means that lots of the other code I added in the previous PR can go away, if we're just always going to be reading these options from the global options service.

AdamYoblick

comment created time in 8 hours

Pull request review commentmicrosoft/PTVS

handle case when attaching instead of launching debugger

 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) {

Thanks, makes sense. I guess what confuses me is the two different ways that you can get these options. The one I used in https://github.com/microsoft/PTVS/pull/6337/files seems to be the PythonToolsService, and those options get packed into the adapterLaunchInfo.LaunchJson...but these other options are being read from the global IPythonDebugOptionsService.

It doesn't make sense to me to have two different paths to the same options. Should I just always be using the global one?

AdamYoblick

comment created time in 8 hours

Pull request review commentmicrosoft/PTVS

handle case when attaching instead of launching debugger

 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) {

so, if adapterLanguageInfo.launchJson is null, when this is called (https://github.com/microsoft/PTVS/blob/b5e38ce254348acce692b4cbe05c449df2c28c2b/Python/Product/PythonTools/PythonTools/Debugger/DebugAdapter/DebugAdapterLauncher.cs#L71), what do we expect?

AdamYoblick

comment created time in 9 hours

pull request commentmicrosoft/PTVS

handle case when attaching instead of launching debugger

Kudos, SonarCloud Quality Gate passed!

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Bugs
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Vulnerabilities
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Security Hotspots
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Code Smells

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' /> No Coverage information
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo.png' alt='No Duplication information' width='16' height='16' /> No Duplication information

AdamYoblick

comment created time in 9 hours

Pull request review commentmicrosoft/PTVS

handle case when attaching instead of launching debugger

 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) {

so what is AddDebuggerOptions for?

AdamYoblick

comment created time in 9 hours

issue commentmicrosoft/PTVS

Failed to launch debug adapter in romote debugging with debugpy.

@zhouwangyang Thank you for catching this regression!

zhouwangyang

comment created time in 9 hours

PR opened microsoft/PTVS

handle case when attaching instead of launching debugger

Fixes #6369

This is a fix for a regression I introduced when reading variable presentation options from the options page

+10 -6

0 comment

1 changed file

pr created time in 9 hours

issue commentmicrosoft/PTVS

Failed to launch debug adapter in romote debugging with debugpy.

Actually, I don't think it's possible to pass along the variablePresentation options when attaching, because the debugger has already been launched. So I think a simple null check is the right fix here.

zhouwangyang

comment created time in 10 hours

issue commentmicrosoft/PTVS

Failed to launch debug adapter in romote debugging with debugpy.

This bug is fixed locally, but the variable presentation options aren't being passed along if the adapterLaunchInfo.LaunchJson is null. I need to fix that as well, will get a PR up soon.

zhouwangyang

comment created time in 10 hours

issue commentmicrosoft/PTVS

Failed to launch debug adapter in romote debugging with debugpy.

@int19h I believe this is due to some parsing of the adapterLaunchInfo I added to support passing variable presentation options to the debugger upon launch. I tested when launching through the VS but I didn't test when debugging by attaching to a remote process, which is causing this error.

Specifically, in DebugAdapterLauncher.cs, line 207:

try {
                var adapterLaunchInfoJson = JObject.Parse(adapterLaunchInfo.LaunchJson);
                AddVariablePresentationOptions(adapterLaunchInfoJson, launchJson);
            } catch (JsonReaderException) {
                // this should never happen
                Debug.Fail("adapterLaunchInfo is not valid json");
            }

This bug is caused by adapterLaunchInfo.LaunchJson being null, which I didn't think could happen. Bad assumption on my part. I'll get it fixed.

zhouwangyang

comment created time in 10 hours

issue openedmicrosoft/debugpy

Python subprocess returns unknown option --module when debugging if 'subProcess: true' in launch.json

Environment data

  • VS Code version: 1.52.1
  • Extension version (available under the Extensions sidebar): v2021.1.502429796
  • OS and version: Win10 (Windows_NT ia32 10.0.16299)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: PyLance
Version: 1.52.1 (system setup)
Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523
Date: 2020-12-16T16:34:50.160Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT ia32 10.0.16299

Expected behaviour

When debugging a python script, it should be able to execute subprocess.run([sys.executable, '-m', 'foo']) successfully (assuming foo module exists).

Actual behaviour

When "subProcess": true is present in launch.json and when debugging a python script that calls subprocess.run([sys.executable, '-m', 'foo']), it fails with the error:

$  /usr/bin/env c:\\Workspace\\bug_subprocess\\venv\\Scripts\\python.exe c:\\Users\\XXX\\.vscode\\extensions\\ms-python.python-2021.1.502429796\\pythonFiles\\lib\\python\\debugpy\\launcher 509
71 -- c:\\Workspace\\bug_subprocess\\run.py
unknown option --module
usage: c:\Workspace\bug_subprocess\venv\Scripts\python.exe [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

Calling script directly from a terminal works as expected.

Steps to reproduce:

  1. Create file foo.py containing:
print('hello from foo')
  1. Create file run.py containing:
import subprocess
import sys
subprocess.run(args=[sys.executable, '-u'] + ['-m', 'foo'])
  1. Create launch.json file containing:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "subProcess": true
        }
    ]
}
  1. Debug run.py

Logs

<details>

<summary>Output for <code>Python</code> in the <code>Output</code> panel (<code>View</code>→<code>Output</code>, change the drop-down the upper-right of the <code>Output</code> panel to <code>Python</code>) </summary>

<p>

User belongs to experiment group 'AlwaysDisplayTestExplorer - control'
User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'RunByLine - experiment'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonInstallPylintButtonFirstcf'
> conda --version
> pyenv root
> python3.7 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.7 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.6 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -2 c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
Error 2021-01-25 17:39:14: Detection of Python Interpreter for Command py and args -3.6 failed as file Python 3.6 not found!

 -3.7-64
 -3.7-32
 -2.7-64 does not exist
> pyenv root
> pyenv root
Error 2021-01-25 17:39:15: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'c:\Workspace\bug_subprocess\.vscode\settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open 'c:\Workspace\bug_subprocess\.vscode\settings.json')
	at _handleError (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:745:473)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async y.readText (c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\out\client\extension.js:9:344778)
	at async p.doesFileNeedToBeFixed (c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\out\client\extension.js:59:500280)
	at async c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\out\client\extension.js:59:499407
	at async Promise.all (index 1)
	at async p.getFilesToBeFixed (c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\out\client\extension.js:59:499353)
	at async p.updateTestSettings (c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\out\client\extension.js:59:498980)] {
  code: 'FileNotFound',
  name: 'EntryNotFound (FileSystemError)'
}
Python interpreter path: .\venv\Scripts\python.exe
Starting Pylance language server.
> pyenv root
> pyenv root
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text c:\Workspace\bug_subprocess\run.py
cwd: c:\Workspace\bug_subprocess
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text c:\Workspace\bug_subprocess\run.py
cwd: c:\Workspace\bug_subprocess
> conda --version
> pyenv root
> pyenv root
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"

Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text c:\Workspace\bug_subprocess\foo.py
cwd: c:\Workspace\bug_subprocess
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text c:\Workspace\bug_subprocess\foo.py
cwd: c:\Workspace\bug_subprocess
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"
> c:\Workspace\bug_subprocess\venv\Scripts\python.exe c:\Users\xxx\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py -c "import pylint"

Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.

</p> </details>

created time in 12 hours

issue openedmicrosoft/PTVS

Visual Studio: Path to debug adapter executable not specified.

Hi, I am struggeling with Remotely debug Python code on Linux. I am following the instructions on this link: https://docs.microsoft.com/de-de/visualstudio/python/debugging-python-code-on-remote-linux-machines?view=vs-2019

I have the following setup:

  • Windows 10 Pro installation with Visual Studio Community 2019, Version 16.8.4
  • Raspberry Pi 4 8GB - up to date installation running phython3.7 with debugpy version 1.2.1
  • Samba connection to the Raspberry is working

I followed the instructions on the above web-site. However when I attach to the process and start the debug process I get the following error "Path to debug adapter executable not specified." No additional hints.

I have tried two different Windows 10 systems. One Windows Pro 10 system was installed from scratch. Also I tried two newely installed Raspberry Pi4 installations with the default Raspberry Image (Debian, 2021-01-11). No change.

I am new to Visual Studio Community application. I am sure I am missing something. But I have no idea where to start my process of narrowing down the issue.

Help would be really appreciated.

Best Juergen

created time in 19 hours

issue openedmicrosoft/debugpy

Issue with remote attach in embedded Python27 interpreter.

Environment data

  • debugpy version: 1.2.1
  • OS and version: Windows 10 Pro
  • Python version (& distribution if applicable, e.g. Anaconda): Python27 embedded into 3DsMax 2018
  • Using VS Code or Visual Studio: VSCode

Actual behavior

Remote attach times out from 3DsMax 2018 - which runs embedded Python27. Here is the stacktrace, from 3DsMax 2018:

Traceback (most recent call last):
  File "C:\p4\Tools\Art\Python\!Shared\Development\R_Shared\R_Debugger.py", line 27, in start
    debugpy.listen(inAddress)
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\__init__.py", line 113, in listen
    return api.listen(address)
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\server\api.py", line 143, in debug
    log.reraise_exception("{0}() failed:", func.__name__, level="info")
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\server\api.py", line 141, in debug
    return func(address, settrace_kwargs, **kwargs)
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\server\api.py", line 232, in listen
    raise RuntimeError("timed out waiting for adapter to connect")
RuntimeError: timed out waiting for adapter to connect

And the error message in VSCode: image

Expected behavior

Remote attach to correctly connect, as it does with 3DsMax 2021 - which runs embedded Python 37.

Steps to reproduce:

VSCode config settings which work in 3DsMax 2021 - Python37, but not 3DsMax 2018 - Python27:

"configurations": [
    {
        "name": "Python: Remote Attach",
        "type": "python",
        "request": "attach",
        "port": 3000,
        "host": "0.0.0.0",
        "pathMappings": [
            {
                "localRoot": "C:/p4/Tools/Art/Python",
                "remoteRoot": "C:/p4/Tools/Art/Python"
            }
        ]
    },
}

Code to run within 3DsMax, which works in 2021 - Python37 and not 2018 - Python27:

import debugpy
import os
import traceback


def start(inAddress, waitForAttach=False):

    try:

        debugpy.configure(python=<externalPythonPath>)
        debugpy.listen(inAddress)
        if waitForAttach:

            print("Waiting for debugger to attach...")
            debugpy.wait_for_client()

    except Exception:

        traceback.print_exc()


def stop():

    return


if __name__ in ("__main__", "__builtin__"):

    start(("0.0.0.0", 3000), waitForAttach=False)

created time in 19 hours

issue commentmicrosoft/debugpy

Code Reloading

Humm, but then editing those contents on the server side (instead of in the editor) would probably be kind of a pain too (and it'd become unsynchronized with the contents of the editor in the client side).

Maybe we could send the contents of the file in the code reload message and have the debug server update that file?

karthiknadig

comment created time in 2 days

issue openedmicrosoft/debug-adapter-protocol

Add an option to suspend or keep the target running when disconnecting from a running debugger

Related to #175. With Go and dlv, when users launch the debugger on a remote machine, they might want to connect to it for multiple disjoint debug sessions. The end of each session then closes the socket connection, but does not terminate the debugger by default. The debugger continues to run and can either keep the target suspended or running. This option is part of the exit command. This could an additional option, so users can pick any of the following combinations:

  • terminateDebuggee=true
  • terminateDebuggee=false, terminateDebugger=true
  • terminateDebuggee=false, terminateDebugger=false, suspendDebuggee=false
  • terminateDebuggee=false, terminateDebugger=false, suspendDebuggee=true

created time in 2 days

issue commentmicrosoft/debugpy

Code Reloading

I think we'll have to do it on debugpy side if only because it won't work otherwise in remote attach scenarios. But the bonus would be that it'd also automatically work for all clients.

Why wouldn't it work with remote attach scenarios (given that the file path would be translated as usual)?

We can do a file watcher, but that comes with lots of caveats by itself, so, if we can avoid it, I think it'd be better...

karthiknadig

comment created time in 3 days

issue commentmicrosoft/debugpy

Code Reloading

My initial idea is that only the file changed on the editor will have code reload applied (so, when the contents of the current editor change and the user saves the file in the editor, then code reload will take place if the editor implementor is interested in doing that -- the initial implementation would be having vscode-python call the a custom message when that happens as I suspect it'll take more time to have that added to the official DAP spec).

So, no file watching should be required (but that's of course up to the editor implementor, debugpy will just provide the support for the reload and can't really dictate how it'll be used).

karthiknadig

comment created time in 3 days

issue closedmicrosoft/PTVS

Si è verificato un errore imprevisto

[Window Title] devenv.exe

[Main Instruction] Si è verificato un errore imprevisto

[Content] Premere CTRL+C per copiare il contenuto di questa finestra di dialogo e segnalare questo errore allo strumento di gestione dei problemi.

[V] Mostra dettagli [Chiudi]

[Expanded Information]

Build: 16.6.20100.1

System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto.
   in Microsoft.VisualStudio.PlatformUI.SetupPackagesCache.GetPackages(String& language, DateTime& installDate, DateTime& lastUpdatedDate, Uri& currentReleaseUri, String& currentProductDisplayVersion, String& currentProductDisplayName)
   in Microsoft.VisualStudio.PlatformUI.SetupPackagesCache.Refresh()
   in Microsoft.VisualStudio.PlatformUI.SetupPackagesCache..ctor()
   in Microsoft.VisualStudio.PlatformUI.SetupPackagesCache.<>c.<.cctor>b__36_0()
   in System.Lazy`1.CreateValue()
   in System.Lazy`1.LazyInitValue()
   in System.Lazy`1.get_Value()
   in Microsoft.VisualStudio.PlatformUI.SetupCompositionService.GetSetupPackagesInfo(UInt32 numberofPackages, IVsSetupPackageInfo[] packageInfo, UInt32& pcActual)
   in Microsoft.PythonTools.Environments.AddInstalledEnvironmentView.GetPackages(IVsSetupCompositionService setupService)
   in Microsoft.PythonTools.Environments.AddInstalledEnvironmentView..ctor(IServiceProvider serviceProvider, ProjectView[] projects, ProjectView selectedProject)
   in Microsoft.PythonTools.Environments.AddEnvironmentDialog.<ShowDialogAsync>d__10.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
   in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in Microsoft.PythonTools.Infrastructure.VSTaskExtensions.<HandleAllExceptions>d__5.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
   in Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

closed time in 3 days

fedetrifo06
more