vscode-powershell
vscode-powershell copied to clipboard
Breakpoint not being hit when attaching to debugger
System Details
Windows10
System Details Output
Issue Description
I am experiencing a problem as the breakpoints are not getting hit when attaching debugger to different pwsh window.
Expected Behaviour
--It should stop at breakpoint
Actual Behaviour
-- It just executed without halting
Attached Logs
vscode-powershell.log StartEditorServices.log EditorServices.log

@nimehta2010 I see you're using attach to process debugging... can you confirm that you are attaching to the right process?
Yes I am attaching to correct process. Nishant Mehta
From: Tyler James Leonhardt [email protected] Sent: 02 July 2020 23:47 To: PowerShell/vscode-powershell [email protected] Cc: Nishant Mehta [email protected]; Mention [email protected] Subject: Re: [PowerShell/vscode-powershell] Breakpoint not being hit when attaching to debugger (#2792)
@nimehta2010https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnimehta2010&data=02%7C01%7CNishant.Mehta%40microsoft.com%7C6af15e2214254834f2fd08d81eb40fc8%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637293106001716555&sdata=tFkWLyyUnnBGo9MlQDIQJJSLRXXenc0ypJfJJ%2FJXfho%3D&reserved=0 I see you're using attach to process debugging... can you confirm that you are attaching to the right process?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPowerShell%2Fvscode-powershell%2Fissues%2F2792%23issuecomment-653153609&data=02%7C01%7CNishant.Mehta%40microsoft.com%7C6af15e2214254834f2fd08d81eb40fc8%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637293106001726546&sdata=S5O%2BfdjRG2HYdd0s89VKvmebVDq002jg8SPg2brAge4%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPS3DWZPDBVP3XLSXOKI5G3RZTFILANCNFSM4OPCSTBQ&data=02%7C01%7CNishant.Mehta%40microsoft.com%7C6af15e2214254834f2fd08d81eb40fc8%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637293106001726546&sdata=MXaeDuIARYAJ%2BlgypVd1ToWllES7snpnUVUJ0aiAuuw%3D&reserved=0.
@nimehta2010 can you please share your launch.json?
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "PowerShell: Interactive Session", "type": "PowerShell", "request": "launch", "cwd": "" }, { "name": ".NET Core Attach", "type": "coreclr", "request": "attach", "processId": "${command:pickProcess}" }, { "name": "PowerShell: Attach to PowerShell Host Process", "type": "PowerShell", "request": "attach", "runspaceId": 1 } ] }
From: Tyler James Leonhardt [email protected] Sent: 02 July 2020 23:51 To: PowerShell/vscode-powershell [email protected] Cc: Nishant Mehta [email protected]; Mention [email protected] Subject: Re: [PowerShell/vscode-powershell] Breakpoint not being hit when attaching to debugger (#2792)
@nimehta2010https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnimehta2010&data=02%7C01%7CNishant.Mehta%40microsoft.com%7Ce4333feefbd141b4253e08d81eb49a98%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637293108323939099&sdata=5ciaxoIN6i5ZPjl2xiRNNuJdBor3kA5TomDl%2BZcMpDw%3D&reserved=0 can you please share your launch.json?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPowerShell%2Fvscode-powershell%2Fissues%2F2792%23issuecomment-653155204&data=02%7C01%7CNishant.Mehta%40microsoft.com%7Ce4333feefbd141b4253e08d81eb49a98%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637293108323939099&sdata=PVYP0bCr0Q3NDlkG9IYeXj3oa4WzmZaJxNNHzu0lDyA%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPS3DW7HOYOGRITJ4GU6XPTRZTFW5ANCNFSM4OPCSTBQ&data=02%7C01%7CNishant.Mehta%40microsoft.com%7Ce4333feefbd141b4253e08d81eb49a98%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637293108323949094&sdata=5bHwdMR0wAG8OQX12gXKoCKoEo36hWXWwZDjxBsPCWs%3D&reserved=0.
Just dropping in to say I have this same issue quite often. It frequently then seems to cascade, ending up at the point where the debugger can't even attach to the separate PowerShell host process (reloading the extensions, VS Code and PowerShell doesn't even seem to fix that, tends to need a reboot).
Same here, Breakpoint does not get hit. However, I am sure i got the right process as "Pausing" is working, when I hit "Pause" during the execution of the script-file, the debugger jumps directly into the current position of the code and I can even step through it. However, any breakpoint in that same file is not hit.
I also noticed, that after disconnection of the debugger, the integrated console-window still is bound. Subsequent Debug-Sessions are not working, it just does not attach anymore. Only possibility is to restart the session of the integrated powershell.
I am using Powershell 7 (x64) by default, however, also tried setting the default powershell to Windows Powershell (5) did not change that issue.
Interactive mode or launching the file directly works. (however, sometimes i need a specific powershell version, thats why I need the "attach" working too.
Yep, confirming the same symptoms as Leo above. Probably unrelated, but just in case it isn't, I'm using Conda environments.
For what it's worth, I'm doing the bits below in a condition where VS Code PS Extension is no longer able to attach to another host process (it times out). Using PS 7.1.3:
- I can attach to the other (first) PS Host process from a second (external to VS Code) PS instance.
- I can also still attach to the other (first) PS Host from the internal terminal in VS Code.
- Once attached, I can set breakpoints in the other (first) PS Host process for the script and see that Get-PSBreakpoints is showing them.
- I can then seemingly successfully enter to begin to debug the runspace that the script will be executing in on the other (first) PS Host process.
- I then run the script, initiating it 'locally' on the other (first) PS Host process.
- In both cases, those breakpoints will be ignored.
As such, it seems like the issue is not just VS Code or the PS extension in VS Code, Something is happening that is making the debugging engine for PS 'non-responsive' to breakpoints, or else it isn't attaching properly (despite appearing to report that it is).
Or, I'm missing something else....
I experience the same problem and can agree with the above descriptions.