PS2011 No Private Variable Debug

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 LICENSE NUMBERS, ACTIVATION 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.
This topic is 12 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
peter_mclean@dodo.com.au
Posts: 88
Last visit: Wed Jan 31, 2024 7:03 pm

PS2011 No Private Variable Debug

Post by peter_mclean@dodo.com.au »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

PS2011 No Private Variable Debug

Post by Alexander Riedel »

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: 88
Last visit: Wed Jan 31, 2024 7:03 pm

PS2011 No Private Variable Debug

Post by peter_mclean@dodo.com.au »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

PS2011 No Private Variable Debug

Post by Alexander Riedel »

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: 88
Last visit: Wed Jan 31, 2024 7:03 pm

PS2011 No Private Variable Debug

Post by peter_mclean@dodo.com.au »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

PS2011 No Private Variable Debug

Post by Alexander Riedel »

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.
This topic is 12 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.