Debugger extremely slow at breakpoints and stepping

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
PaschalIT
Posts: 38
Joined: Tue Apr 02, 2019 4:37 pm

Debugger extremely slow at breakpoints and stepping

Post by PaschalIT » Wed Dec 04, 2019 3:51 pm

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: Powershell Studio v5.6.170 & v5.6.166
32 or 64 bit version of product: 64-bit
Operating system: Windows 10
32 or 64 bit OS: 64-bit

*** Please add details and screenshots as needed below. ***

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM


Seemingly out of nowhere, when trying to debug my (rather large) project the debugger has started to take an extremely long time to get to the "break" status when interacting with a breakpoint. Similarly, it takes a very long time to break again when I try to step through my lines. Previously I could step through very quickly, and I'm not sure what would have changed to cause this.

I've tested on version 5.6.170 (latest) and 5.6.166, thinking that maybe grabbing a build from back when (I think) this wasn't occurring might help, but there's no change. I've seen posts with similar issues where the topic of dynamic variables was discussed... Is there a way to turn this off?

User avatar
Alexander Riedel
Posts: 7129
Joined: Tue May 29, 2007 4:43 pm

Re: Debugger extremely slow at breakpoints and stepping

Post by Alexander Riedel » Wed Dec 04, 2019 4:09 pm

Debugger slowness can be caused by the system, the underlying script, a remote connection or the sheer amount of data transmitted.
I am not sure what you mean with dynamic variables, maybe you can point out the thread you are referring to?

In general, load up a small, simple script and try the debugger. Is is equally sluggish? If so, there is something in your system at play. Could have been a Windows Update, could be transient. Try a reboot in that case.
If a smaller, simpler script debugs fine, look at the watch panel. If you have a variable in there which requires large amounts of data being transmitted back to the IDE, that would probably do it. Remove whatever you have in the watch panel.
Dynamic breakpoints are huge performance drain. If you added one on a global variable for read AND write, it can slow down thing tremendously. Try removing dynamic breakpoints altogether.

Let us know if any of this helps.
Alexander Riedel
SAPIEN Technologies, Inc.

PaschalIT
Posts: 38
Joined: Tue Apr 02, 2019 4:37 pm

Re: Debugger extremely slow at breakpoints and stepping

Post by PaschalIT » Thu Dec 05, 2019 7:32 am

A reboot did not help, sadly. I'm not sure what you mean by dynamic breakpoint, though... I'm using a regular break point at a place where I need to test an issue, but I do not know whether it's dynamic or not.

Here is the thread I was mentioning earlier. It doesn't seem to be the exact same issue, but it's similar. It's from back in 2017. I misremembered the reference they were making - it was to dynamic properties, not dynamic variables.
viewtopic.php?t=11740

It does seem like it must be something with my script, though, as your suggestion to try a small script worked without issue. I know it's kind of a long shot, but can you think of anything which might cause this problem? I'm hesitant to share my code as it is a large project and would take quite a bit of time to sanitize.

PaschalIT
Posts: 38
Joined: Tue Apr 02, 2019 4:37 pm

Re: Debugger extremely slow at breakpoints and stepping

Post by PaschalIT » Thu Dec 05, 2019 7:44 am

My project does have a very large number of controls in its form. Is it possible it could be trying to dynamically update every control as it attempts to debug? The project has very little issue with lag when running normally, it is only when debugging that it slows down, and it's a drastic difference. Debugging takes upwards of 5 minutes each time I try to step.

It's odd, too... I watched a performance monitor to see if I was possibly capping out my CPU or using too much memory, but instead of spiking to high percentages as I had predicted, I'm actually dropping down to 10% and less CPU usage when Powershell Studio is supposed to be hitting a breakpoint.

In addition, for reference, I have no items in my Watch list and also cleared out the session variables from the Variables tab.

Edit: As another note, when it does finally reach a break status where I can choose to step or view variables, etc, hovering over variables in my code never seems to be able to load the property like it used to. It sits reading "Loading Value" for at least minutes.

PaschalIT
Posts: 38
Joined: Tue Apr 02, 2019 4:37 pm

Re: Debugger extremely slow at breakpoints and stepping

Post by PaschalIT » Thu Dec 05, 2019 2:31 pm

Well, I found the source of the problem via some heavy digging through old versions of my code...

The culprit was a global variable I had created in Globals.ps1. I'm not sure why, but I had made a global [adsisearcher] which I was using in several places, and for some reason that was what was causing debug to lag 5+ minutes every step. If anyone can come up with a reason why this would have happened with that particular variable, I'm curious to know.

User avatar
Alexander Riedel
Posts: 7129
Joined: Tue May 29, 2007 4:43 pm

Re: Debugger extremely slow at breakpoints and stepping

Post by Alexander Riedel » Fri Dec 06, 2019 9:39 am

Interesting. It must cause a massive amount of data to be transmitted back.
Alexander Riedel
SAPIEN Technologies, Inc.