Page 1 of 1

Variables Pane in PS Studio 2015

Posted: Thu Feb 11, 2016 11:32 am
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

Re: Variables Pane in PS Studio 2015

Posted: Thu Feb 11, 2016 4:47 pm
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.