microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.53k stars 675 forks source link

The output is wrong when debug in Python2.7 with conditions and actions breakpoint. #6012

Closed linette-zyy closed 4 years ago

linette-zyy commented 4 years ago

VS version image

Steps to Reproduce 1.Create python application 2.Type code in default .py file

from math import cos, radians
def make_dot_string(x):
    rad = radians(x)  
    numspaces = int(20 * cos(radians(x)) + 20)  
    st = ' ' * numspaces + 'o' 
    return st
def main():
    for i in range(0, 1800, 12):
        s = make_dot_string(i)
        print(s)
main()

3.Set a conditions breakpoint, hover on red dot and click breakpoint setting image 4.Create expressions using Python code like i > 1600 and click "Add condition" to add more expressions 5.Create a message to log to the output window, iptionally continuing execution automatically image 6.F5 to start to debug

Expected behavior Print successfully in output window image

Actual behavior The output is wrong. image

Host log

 1> DebugAdapterHost version: 16.5.40204.1 commit:9912dfe8bb23c205b584e6f5577c6e9655d39afb
 1> Starting 'C:\Python27\python.exe' with arguments '"c:\program files (x86)\microsoft visual studio\2019\preview\common7\ide\extensions\microsoft\python\core\Packages\ptvsd\adapter"'
 1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":null,"locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsHandshakeRequest":true},"seq":1}
 1> [DebugAdapter] <--   E (output): {"seq": 1, "type": "event", "event": "output", "body": {"category": "telemetry", "output": "ptvsd", "data": {"packageVersion": "5.0.0a12"}}}
 1> [DebugAdapter] <--   R (initialize-1) [184 ms]: {"seq": 2, "type": "response", "request_seq": 1, "success": true, "command": "initialize", "body": {"supportsModulesRequest": true, "supportsConfigurationDoneRequest": true, "supportsDelayedStackTraceLoading": true, "supportsDebuggerProperties": true, "supportsHitConditionalBreakpoints": true, "supportsSetExpression": true, "supportsGotoTargetsRequest": true, "supportsSetVariable": true, "supportsLogPoints": true, "supportsCompletionsRequest": true, "exceptionBreakpointFilters": [{"filter": "raised", "default": false, "label": "Raised Exceptions"}, {"filter": "uncaught", "default": true, "label": "Uncaught Exceptions"}], "supportsExceptionInfoRequest": true, "supportsValueFormattingOptions": true, "supportsEvaluateForHovers": true, "supportsExceptionOptions": true, "supportsTerminateDebuggee": true, "supportsConditionalBreakpoints": true}}
 1> [DebugAdapter] --> C (launch-2): {"type":"request","command":"launch","arguments":{"noDebug":false,"cwd":"C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\","python":["C:\\Python27\\python.exe"],"console":"externalTerminal","program":["C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py"],"django":false,"stopOnEntry":true,"promptBeforeRunningWithBuildError":true,"redirectOutput":true,"waitOnAbnormalExit":true,"waitOnNormalExit":true,"breakOnSystemExitZero":false,"debugStdLib":false,"showReturnValue":true,"env":{"PROCESSOR_ARCHITEW6432":"AMD64","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","COMPUTERNAME":"vyizh12002","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","OneDrive":"C:\\Users\\vyizh12\\OneDrive","PkgDefApplicationConfigFile":"C:\\Users\\vyizh12\\AppData\\Local\\Microsoft\\VisualStudio\\16.0_dbf10704\\devenv.exe.config","HOMEPATH":"\\Users\\vyizh12","VisualStudioEdition":"Microsoft Visual Studio Enterprise 2019","_PTVS_PID":"5188","ServiceHubLogSessionKey":"E6B9C223","PROCESSOR_REVISION":"5504","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","COMPLUS_InstallRoot":"","USERDOMAIN_ROAMINGPROFILE":"vyizh12002","TEMP":"C:\\Users\\vyizh12\\AppData\\Local\\Temp","LOCALAPPDATA":"C:\\Users\\vyizh12\\AppData\\Local","PUBLIC":"C:\\Users\\Public","VSAPPIDNAME":"devenv.exe","USERDOMAIN":"vyizh12002","ProgramFiles(x86)":"C:\\Program Files (x86)","Path":"C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Users\\vyizh12\\AppData\\Local\\Microsoft\\WindowsApps","PROCESSOR_LEVEL":"6","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 85 Stepping 4, GenuineIntel","PSModulePath":"%ProgramFiles%\\WindowsPowerShell\\Modules;C:\\windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\PowerShell\\","NUMBER_OF_PROCESSORS":"4","FPS_BROWSER_USER_PROFILE_STRING":"Default","CommonProgramFiles":"C:\\Program Files (x86)\\Common Files","VisualStudioDir":"C:\\Users\\vyizh12\\Documents\\Visual Studio 2019","ProgramData":"C:\\ProgramData","ProgramW6432":"C:\\Program Files","ProgramFiles":"C:\\Program Files (x86)","VSSKUEDITION":"Enterprise","ThreadedWaitDialogDpiContext":"-2","TMP":"C:\\Users\\vyizh12\\AppData\\Local\\Temp","VSAPPIDDIR":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\Common7\\IDE\\","VisualStudioVersion":"16.0","SystemRoot":"C:\\windows","CommonProgramW6432":"C:\\Program Files\\Common Files","LOGONSERVER":"\\\\vyizh12002","USERPROFILE":"C:\\Users\\vyizh12","MSBuildLoadMicrosoftTargetsReadOnly":"true","VSLANG":"1033","APPDATA":"C:\\Users\\vyizh12\\AppData\\Roaming","HOMEDRIVE":"C:","COMPLUS_Version":"","USERNAME":"vyizh12","PYTHONPATH":"C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\","FPS_BROWSER_APP_PROFILE_STRING":"Internet Explorer","PROCESSOR_ARCHITECTURE":"x86","OS":"Windows_NT","ComSpec":"C:\\windows\\system32\\cmd.exe","SystemDrive":"C:","windir":"C:\\windows","ALLUSERSPROFILE":"C:\\ProgramData"}},"seq":2}
 1> [DebugAdapter] <--   C (runInTerminal-3): {"seq": 3, "type": "request", "command": "runInTerminal", "arguments": {"kind": "external", "args": ["C:\\Python27\\python.exe", "c:\\program files (x86)\\microsoft visual studio\\2019\\preview\\common7\\ide\\extensions\\microsoft\\python\\core\\Packages\\ptvsd\\launcher", "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py"], "env": {"PTVSD_LAUNCHER_PORT": "53922"}, "title": "Python Debug Console"}}
 1> [DebugAdapter] --> R (runInTerminal-3): {"type":"response","request_seq":3,"success":true,"command":"runInTerminal","body":{"processId":6104},"seq":3}
 1> [DebugAdapter] <--   E (initialized): {"seq": 4, "type": "event", "event": "initialized"}
 1> [DebugAdapter] --> C (setDebuggerProperty-4): {"type":"request","command":"setDebuggerProperty","arguments":{"AllowOutOfProcessSymbols":1},"seq":4}
 1> [DebugAdapter] --> C (setDebuggerProperty-5): {"type":"request","command":"setDebuggerProperty","arguments":{"DisableJITOptimization":0},"seq":5}
 1> [DebugAdapter] --> C (setDebuggerProperty-6): {"type":"request","command":"setDebuggerProperty","arguments":{"EnableFastEvaluate":1},"seq":6}
 1> [DebugAdapter] --> C (setDebuggerProperty-7): {"type":"request","command":"setDebuggerProperty","arguments":{"InterpreterOptions":1},"seq":7}
 1> [DebugAdapter] --> C (setDebuggerProperty-8): {"type":"request","command":"setDebuggerProperty","arguments":{"JustMyCodeStepping":1},"seq":8}
 1> [DebugAdapter] --> C (setDebuggerProperty-9): {"type":"request","command":"setDebuggerProperty","arguments":{"StopOnExceptionCrossingManagedBoundary":0},"seq":9}
 1> [DebugAdapter] --> C (setDebuggerProperty-10): {"type":"request","command":"setDebuggerProperty","arguments":{"WarnIfNoUserCodeOnLaunch":1},"seq":10}
 1> [DebugAdapter] --> C (setDebuggerProperty-11): {"type":"request","command":"setDebuggerProperty","arguments":{"EnableStepFiltering":true},"seq":11}
 1> [DebugAdapter] --> C (setBreakpoints-12): {"type":"request","command":"setBreakpoints","arguments":{"source":{"path":"c:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py","sources":[],"checksums":[]},"breakpoints":[{"line":11,"column":1,"condition":"i>1600"}],"lines":[11]},"seq":12}
 1> [DebugAdapter] <--   R (setDebuggerProperty-4) [39 ms]: {"seq": 5, "type": "response", "request_seq": 4, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] <--   R (setDebuggerProperty-5) [37 ms]: {"seq": 6, "type": "response", "request_seq": 5, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] <--   R (setDebuggerProperty-6) [37 ms]: {"seq": 7, "type": "response", "request_seq": 6, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] <--   R (setDebuggerProperty-7) [37 ms]: {"seq": 8, "type": "response", "request_seq": 7, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] <--   R (setDebuggerProperty-8) [37 ms]: {"seq": 9, "type": "response", "request_seq": 8, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] --> C (setExceptionBreakpoints-13): {"type":"request","command":"setExceptionBreakpoints","arguments":{"filters":[],"exceptionOptions":[{"breakMode":"userUnhandled","path":[{"names":["Python Exceptions"]}]},{"breakMode":"unhandled","path":[{"names":["Python Exceptions"]},{"names":["GeneratorExit","IndexError","StopIteration","AttributeError","KeyError"]}]}]},"seq":13}
 1> [DebugAdapter] <--   R (setDebuggerProperty-9) [48 ms]: {"seq": 10, "type": "response", "request_seq": 9, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] <--   R (setDebuggerProperty-10) [49 ms]: {"seq": 11, "type": "response", "request_seq": 10, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] <--   R (setDebuggerProperty-11) [49 ms]: {"seq": 12, "type": "response", "request_seq": 11, "success": true, "command": "setDebuggerProperty"}
 1> [DebugAdapter] <--   R (setBreakpoints-12) [56 ms]: {"seq": 13, "type": "response", "request_seq": 12, "success": true, "command": "setBreakpoints", "body": {"breakpoints": [{"source": {"checksums": [], "sources": [], "path": "c:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py"}, "line": 11, "verified": true, "id": 0}]}}
 1> [DebugAdapter] <--   R (setExceptionBreakpoints-13) [22 ms]: {"seq": 14, "type": "response", "request_seq": 13, "success": true, "command": "setExceptionBreakpoints"}
 1> [DebugAdapter] --> C (configurationDone-14): {"type":"request","command":"configurationDone","arguments":{},"seq":14}
 1> [DebugAdapter] <--   R (configurationDone-14) [7 ms]: {"seq": 15, "type": "response", "request_seq": 14, "success": true, "command": "configurationDone"}
 1> [DebugAdapter] <--   R (launch-2) [794 ms]: {"seq": 16, "type": "response", "request_seq": 2, "success": true, "command": "launch"}
 1> [DebugAdapter] <--   E (process): {"seq": 17, "type": "event", "event": "process", "body": {"pointerSize": 32, "startMethod": "launch", "isLocalProcess": true, "systemProcessId": 9756, "name": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py"}}
 1> [DebugAdapter] <--   E (thread): {"seq": 18, "type": "event", "event": "thread", "body": {"reason": "started", "threadId": 1}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 19, "type": "event", "event": "stopped", "body": {"reason": "entry", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-15): {"type":"request","command":"threads","arguments":{},"seq":15}
 1> [DebugAdapter] <--   R (threads-15) [6 ms]: {"seq": 20, "type": "response", "request_seq": 15, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (continue-16): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":16}
 1> [DebugAdapter] <--   E (output): {"seq": 22, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                                        "}}
 1> [DebugAdapter] <--   R (continue-16) [8 ms]: {"seq": 21, "type": "response", "request_seq": 16, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 23, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\n                                       o\n                                      o\n                                    o\n                                 o\n                              o\n                          o\n                      o\n                 o\n             o\n          o\n"}}
 1> [DebugAdapter] <--   E (output): {"seq": 24, "type": "event", "event": "output", "body": {"category": "stdout", "output": "      o\n   o\n o\no\no\no\n o\n   o\n      o\n         o\n             o\n                 o\n                      o\n                          o\n                              o\n                                 o\n                                    o\n                                      o\n                                       o\n                                        o\n                                       o\n                                      o\n                                    o\n                                 o\n                             o\n                          o\n                      o\n                 o\n             o\n          o\n      o\n   o\n o\no\no\no\n o\n   o\n      o\n          o\n             o\n                 o\n                      o\n                          o\n                             o\n                                 o\n                                    o\n                                      o\n                                       o\n                                        o\n                                       o\n                                      o\n                                    o\n                                 o\n                              o\n                          o\n                      o\n                 o\n             o\n         o\n      o\n   o\n o\no\no\no\n o\n   o\n      o\n         o\n             o\n                 o\n                      o\n                          o\n                              o\n                                 o\n                                    o\n                                      o\n                                       o\n                                        o\n                                       o\n                                      o\n                                    o\n                                 o\n                              o\n                          o\n                      o\n                 o\n             o\n         o\n      o\n   o\n o\no\no\no\n o\n   o\n      o\n         o\n             o\n                 o\n                      o\n                          o\n                              o\n                                 o\n                                    o\n                                      o\n                                       o\n                                        o\n                                       o\n                                      o\n                                    o\n                                 o\n                              o\n                          o\n                      o\n                 o\n             o\n         o\n      o\n   o\n o\no\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 25, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-17): {"type":"request","command":"threads","arguments":{},"seq":17}
 1> [DebugAdapter] <--   R (threads-17) [2 ms]: {"seq": 26, "type": "response", "request_seq": 17, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-18): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":18}
 1> [DebugAdapter] <--   E (module): {"seq": 28, "type": "event", "event": "module", "body": {"reason": "new", "module": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "id": 0, "name": "__main__", "package": "None"}}}
 1> [DebugAdapter] <--   R (stackTrace-18) [25 ms]: {"seq": 27, "type": "response", "request_seq": 18, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] <--   E (module): {"seq": 29, "type": "event", "event": "module", "body": {"reason": "new", "module": {"path": "C:\\Python27\\Lib\\runpy.py", "id": 1, "name": "runpy", "package": "None"}}}
 1> [DebugAdapter] --> C (continue-19): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":19}
 1> [DebugAdapter] <--   R (continue-19) [22 ms]: {"seq": 30, "type": "response", "request_seq": 19, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 31, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-20): {"type":"request","command":"threads","arguments":{},"seq":20}
 1> [DebugAdapter] <--   R (threads-20) [3 ms]: {"seq": 32, "type": "response", "request_seq": 20, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-21): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":21}
 1> [DebugAdapter] <--   R (stackTrace-21) [5 ms]: {"seq": 33, "type": "response", "request_seq": 21, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-22): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":22}
 1> [DebugAdapter] <--   R (continue-22) [5 ms]: {"seq": 34, "type": "response", "request_seq": 22, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 35, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-23): {"type":"request","command":"threads","arguments":{},"seq":23}
 1> [DebugAdapter] <--   R (threads-23) [3 ms]: {"seq": 36, "type": "response", "request_seq": 23, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-24): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":24}
 1> [DebugAdapter] <--   R (stackTrace-24) [5 ms]: {"seq": 37, "type": "response", "request_seq": 24, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-25): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":25}
 1> [DebugAdapter] <--   R (continue-25) [6 ms]: {"seq": 38, "type": "response", "request_seq": 25, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 39, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-26): {"type":"request","command":"threads","arguments":{},"seq":26}
 1> [DebugAdapter] <--   R (threads-26) [2 ms]: {"seq": 40, "type": "response", "request_seq": 26, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-27): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":27}
 1> [DebugAdapter] <--   R (stackTrace-27) [4 ms]: {"seq": 41, "type": "response", "request_seq": 27, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-28): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":28}
 1> [DebugAdapter] <--   R (continue-28) [6 ms]: {"seq": 42, "type": "response", "request_seq": 28, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 43, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-29): {"type":"request","command":"threads","arguments":{},"seq":29}
 1> [DebugAdapter] <--   R (threads-29) [3 ms]: {"seq": 44, "type": "response", "request_seq": 29, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-30): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":30}
 1> [DebugAdapter] <--   R (stackTrace-30) [2 ms]: {"seq": 45, "type": "response", "request_seq": 30, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-31): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":31}
 1> [DebugAdapter] <--   R (continue-31) [16 ms]: {"seq": 46, "type": "response", "request_seq": 31, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 47, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-32): {"type":"request","command":"threads","arguments":{},"seq":32}
 1> [DebugAdapter] <--   R (threads-32) [3 ms]: {"seq": 48, "type": "response", "request_seq": 32, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-33): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":33}
 1> [DebugAdapter] <--   R (stackTrace-33) [4 ms]: {"seq": 49, "type": "response", "request_seq": 33, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-34): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":34}
 1> [DebugAdapter] <--   E (output): {"seq": 51, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\no\n o\n   o\n      o\n"}}
 1> [DebugAdapter] <--   R (continue-34) [15 ms]: {"seq": 50, "type": "response", "request_seq": 34, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 52, "type": "event", "event": "output", "body": {"category": "stdout", "output": "          "}}
 1> [DebugAdapter] <--   E (output): {"seq": 53, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 54, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-35): {"type":"request","command":"threads","arguments":{},"seq":35}
 1> [DebugAdapter] <--   R (threads-35) [2 ms]: {"seq": 55, "type": "response", "request_seq": 35, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-36): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":36}
 1> [DebugAdapter] <--   R (stackTrace-36) [4 ms]: {"seq": 56, "type": "response", "request_seq": 36, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-37): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":37}
 1> [DebugAdapter] <--   E (output): {"seq": 57, "type": "event", "event": "output", "body": {"category": "stdout", "output": "             o"}}
 1> [DebugAdapter] <--   R (continue-37) [18 ms]: {"seq": 58, "type": "response", "request_seq": 37, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 59, "type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 60, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-38): {"type":"request","command":"threads","arguments":{},"seq":38}
 1> [DebugAdapter] <--   R (threads-38) [6 ms]: {"seq": 61, "type": "response", "request_seq": 38, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-39): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":39}
 1> [DebugAdapter] <--   R (stackTrace-39) [4 ms]: {"seq": 62, "type": "response", "request_seq": 39, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-40): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":40}
 1> [DebugAdapter] <--   E (output): {"seq": 64, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                 o"}}
 1> [DebugAdapter] <--   R (continue-40) [10 ms]: {"seq": 63, "type": "response", "request_seq": 40, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 65, "type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 66, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-41): {"type":"request","command":"threads","arguments":{},"seq":41}
 1> [DebugAdapter] <--   R (threads-41) [5 ms]: {"seq": 67, "type": "response", "request_seq": 41, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-42): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":42}
 1> [DebugAdapter] <--   R (stackTrace-42) [4 ms]: {"seq": 68, "type": "response", "request_seq": 42, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-43): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":43}
 1> [DebugAdapter] <--   E (output): {"seq": 69, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                      "}}
 1> [DebugAdapter] <--   R (continue-43) [9 ms]: {"seq": 70, "type": "response", "request_seq": 43, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 71, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 72, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-44): {"type":"request","command":"threads","arguments":{},"seq":44}
 1> [DebugAdapter] <--   R (threads-44) [7 ms]: {"seq": 73, "type": "response", "request_seq": 44, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-45): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":45}
 1> [DebugAdapter] <--   R (stackTrace-45) [4 ms]: {"seq": 74, "type": "response", "request_seq": 45, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-46): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":46}
 1> [DebugAdapter] <--   E (output): {"seq": 75, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                          "}}
 1> [DebugAdapter] <--   R (continue-46) [736 ms]: {"seq": 76, "type": "response", "request_seq": 46, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 77, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 78, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-47): {"type":"request","command":"threads","arguments":{},"seq":47}
 1> [DebugAdapter] <--   R (threads-47) [6 ms]: {"seq": 79, "type": "response", "request_seq": 47, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-48): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":48}
 1> [DebugAdapter] <--   R (stackTrace-48) [5 ms]: {"seq": 80, "type": "response", "request_seq": 48, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-49): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":49}
 1> [DebugAdapter] <--   E (output): {"seq": 81, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                              "}}
 1> [DebugAdapter] <--   R (continue-49) [17 ms]: {"seq": 82, "type": "response", "request_seq": 49, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 83, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 84, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-50): {"type":"request","command":"threads","arguments":{},"seq":50}
 1> [DebugAdapter] <--   R (threads-50) [5 ms]: {"seq": 85, "type": "response", "request_seq": 50, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-51): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":51}
 1> [DebugAdapter] <--   R (stackTrace-51) [4 ms]: {"seq": 86, "type": "response", "request_seq": 51, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-52): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":52}
 1> [DebugAdapter] <--   E (output): {"seq": 88, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                                 o"}}
 1> [DebugAdapter] <--   R (continue-52) [16 ms]: {"seq": 87, "type": "response", "request_seq": 52, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 89, "type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 90, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-53): {"type":"request","command":"threads","arguments":{},"seq":53}
 1> [DebugAdapter] <--   R (threads-53) [23 ms]: {"seq": 91, "type": "response", "request_seq": 53, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-54): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":54}
 1> [DebugAdapter] <--   R (stackTrace-54) [18 ms]: {"seq": 92, "type": "response", "request_seq": 54, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-55): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":55}
 1> [DebugAdapter] <--   E (output): {"seq": 94, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                                    "}}
 1> [DebugAdapter] <--   R (continue-55) [11 ms]: {"seq": 93, "type": "response", "request_seq": 55, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 95, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 96, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-56): {"type":"request","command":"threads","arguments":{},"seq":56}
 1> [DebugAdapter] <--   R (threads-56) [6 ms]: {"seq": 97, "type": "response", "request_seq": 56, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-57): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":57}
 1> [DebugAdapter] <--   R (stackTrace-57) [5 ms]: {"seq": 98, "type": "response", "request_seq": 57, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-58): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":58}
 1> [DebugAdapter] <--   E (output): {"seq": 100, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                                      "}}
 1> [DebugAdapter] <--   R (continue-58) [9 ms]: {"seq": 99, "type": "response", "request_seq": 58, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 101, "type": "event", "event": "output", "body": {"category": "stdout", "output": "o\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 102, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-59): {"type":"request","command":"threads","arguments":{},"seq":59}
 1> [DebugAdapter] <--   R (threads-59) [6 ms]: {"seq": 103, "type": "response", "request_seq": 59, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-60): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":60}
 1> [DebugAdapter] <--   R (stackTrace-60) [4 ms]: {"seq": 104, "type": "response", "request_seq": 60, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-61): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":61}
 1> [DebugAdapter] <--   E (output): {"seq": 105, "type": "event", "event": "output", "body": {"category": "stdout", "output": "                                       o"}}
 1> [DebugAdapter] <--   R (continue-61) [16 ms]: {"seq": 106, "type": "response", "request_seq": 61, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (output): {"seq": 107, "type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}}
 1> [DebugAdapter] <--   E (stopped): {"seq": 108, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "preserveFocusHint": false, "allThreadsStopped": true, "threadId": 1}}
 1> [DebugAdapter] --> C (threads-62): {"type":"request","command":"threads","arguments":{},"seq":62}
 1> [DebugAdapter] <--   R (threads-62) [5 ms]: {"seq": 109, "type": "response", "request_seq": 62, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
 1> [DebugAdapter] --> C (stackTrace-63): {"type":"request","command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":1,"format":{"includeAll":true}},"seq":63}
 1> [DebugAdapter] <--   R (stackTrace-63) [4 ms]: {"seq": 110, "type": "response", "request_seq": 63, "success": true, "command": "stackTrace", "body": {"totalFrames": 2, "stackFrames": [{"column": 1, "source": {"path": "C:\\Users\\vyizh12\\source\\repos\\PythonApplication2\\PythonApplication2\\PythonApplication2.py", "sourceReference": 0}, "line": 11, "id": 2, "name": "main"}]}}
 1> [DebugAdapter] --> C (continue-64): {"type":"request","command":"continue","arguments":{"threadId":1},"seq":64}
 1> [DebugAdapter] <--   R (continue-64) [15 ms]: {"seq": 111, "type": "response", "request_seq": 64, "success": true, "command": "continue", "body": {"allThreadsContinued": true}}
 1> [DebugAdapter] <--   E (thread): {"seq": 112, "type": "event", "event": "thread", "body": {"reason": "exited", "threadId": 1}}
 1> [DebugAdapter] <--   E (exited): {"seq": 113, "type": "event", "event": "exited", "body": {"exitCode": 0}}
 1> [DebugAdapter] <--   E (terminated): {"seq": 114, "type": "event", "event": "terminated"}
 1> [DebugAdapter] --> C (disconnect-65): {"type":"request","command":"disconnect","arguments":{},"seq":65}
 1> [DebugAdapter] <--   R (disconnect-65) [2 ms]: {"seq": 115, "type": "response", "request_seq": 65, "success": true, "command": "disconnect"}
 1> Debug adapter process exited.
int19h commented 4 years ago

This is basically https://github.com/microsoft/ptvsd/issues/1769#issuecomment-531792777. We do not guarantee ordered output in the terminal for this scenario. However, if "redirectOutput":true is set, then things should be ordered correctly in Debug Console.

huguesv commented 4 years ago

Thanks. I'll close as won't fix as this seem low priority.