Variables Pane in PS Studio 2015

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
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.
User avatar
Posts: 5
Joined: Mon May 04, 2015 6:38 am

Variables Pane in PS Studio 2015

Post by jbudde »

Hey again everyone -

I am wondering how to get the variables pane working? It should be able to display the current values of variables during any run (like powergui does) correct? Right now I can't get it to display anything, even when debugging. This is an incredibly useful feature in powergui all the time - not just during debugging - so I hope we can figure this out.

Product, version and build: Powershell Studio 2015, v4.2.99, (how do I find the build?)
32 or 64 bit version of product: 64
Operating system: Win 7 enterprise x64
32 or 64 bit OS: 64

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

Re: Variables Pane in PS Studio 2015

Post by Alexander Riedel »

Ok, so I will try to answer this as best as I can. There are some philosophical differences here.
PowerShell Studio (as well as PrimalScript) is a Script Development Environment. The PowerShell ISE (to use another example) is a learning tool and a console. The requirements for both are quite different.
When developing a script and debugging it, reproducing results and maintaining exact start conditions is paramount. Otherwise you just fudge things and your script will only work on your machine. That is why every time you run a script in PowerShell Studio (debugging or not) you get a new, fresh and empty runspace.
Which leads to the variables pane. It shows you the state of variables while debugging AND when stopped at a breakpoint. Outside of that context neither any variables nor their state can be displayed because they simply do not exist.
So if you just run your script or run it in the debugger WITHOUT any breakpoints, that variable window will just be empty.

Of course you are correct that sometimes it is helpful to examine the state of variables after a script ran. Specially when it didn't work, you may need to see what happened. Specially in this horrible cases where everything works fine when debugging step by step but not when you run a script just by itself.
In that case just run your script in the built-in console (Ctrl+Shift+F5). Then you can go in after the fact and examine everything in that console.
For those lurking and asking why this is not some fancy graphical do-it-all console rather than a bare-bones PowerShell console, again, this is to help you reproduce results. It will not help you if you test your script in some hyper-modern custom shell implementation we created. You need to always test in the environment you will ultimately run your scripts, which is usually the good old PowerShell console.
Alexander Riedel
SAPIEN Technologies, Inc.