PS2011 No Private Variable Debug

Support for all customers who have purchased a PrimalScript product license. This forum 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.
User avatar
peter_mclean@dodo.com.au
Posts: 85
Joined: Fri Jul 08, 2011 5:51 pm

PS2011 No Private Variable Debug

Post by peter_mclean@dodo.com.au » Thu Nov 03, 2011 2:41 pm

PS 2011 V6.0.154 XP Profession SP3
When debugging a Powershell script in the Primalscript Editor/Debugger, variables that are defined as private in a function, show empty results in the Watch Window and do not appear at all in the Variables Window. Please refer to the 1st snapshot noting that $gca_CrackerUserArray that is not scoped as private appears in the Variables Window, whereas $gca_CrackerUser that is scoped as private, does not. Also please note that the Result in the Watch Window for $gca_CrackerUser is (Empty).
Also please note on the 2nd snapshot that the $gca_CrackerUserArray has a result in the Watch Window. Also please note that Primalscript crashed shortly after i took the 2nd snapshot, with an out of memory error.
NoPrivateVariableDebug.jpg
NoPrivateVariableDebug1.jpgpmclean@labelmakers.com.au2011-11-03 21:49:09

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

PS2011 No Private Variable Debug

Post by Alexander Riedel » Thu Nov 03, 2011 7:56 pm

I will look into it.

As for the crash, where you able to save any of the crash data?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
peter_mclean@dodo.com.au
Posts: 85
Joined: Fri Jul 08, 2011 5:51 pm

PS2011 No Private Variable Debug

Post by peter_mclean@dodo.com.au » Wed Nov 09, 2011 8:51 am

Have just installed PS 2011 V6.0.155. I have not had any problems with out of memory, but the private variable values are still not available. Here are the snapshots from the debugger showing 1) test script 2) intended output for script 3) watch on not-private variable 4) watch on private variable.

TestDebugPrivateVariablesScript.jpg
TestDebugPrivateVariablesScriptOutput.jpg
TestDebugPrivateVariables1.jpg
TestDebugPrivateVariables2.jpg

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

PS2011 No Private Variable Debug

Post by Alexander Riedel » Wed Nov 09, 2011 9:59 am

PowerShell's debugging interface has no means whatsoever to determine the content of private variables or even check for their existence. I have forwarded you complaint to Microsoft, hoping that some day they may add a way to query for those.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
peter_mclean@dodo.com.au
Posts: 85
Joined: Fri Jul 08, 2011 5:51 pm

PS2011 No Private Variable Debug

Post by peter_mclean@dodo.com.au » Wed Nov 09, 2011 10:10 am

Thanks Alex for your very valued input. I now undertand why. I suppose I'll just have to use the Microsoft Powershell ISE or the PowerGUI Script Editor when I need to debug private variables.

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

PS2011 No Private Variable Debug

Post by Alexander Riedel » Wed Nov 09, 2011 10:13 am

I knew you would say that :-)
I am sure there is a hack, but we tend to stick with the official API.
Alexander Riedel
SAPIEN Technologies, Inc.