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
PS2011 No Private Variable Debug
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.
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.
- peter_mclean@dodo.com.au
- Posts: 88
- Last visit: Wed Jan 31, 2024 7:03 pm
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
PS2011 No Private Variable Debug
I will look into it.
As for the crash, where you able to save any of the crash data?
As for the crash, where you able to save any of the crash data?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- peter_mclean@dodo.com.au
- Posts: 88
- Last visit: Wed Jan 31, 2024 7:03 pm
PS2011 No Private Variable Debug
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
TestDebugPrivateVariablesScript.jpg
TestDebugPrivateVariablesScriptOutput.jpg
TestDebugPrivateVariables1.jpg
TestDebugPrivateVariables2.jpg
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
PS2011 No Private Variable Debug
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.
SAPIEN Technologies, Inc.
- peter_mclean@dodo.com.au
- Posts: 88
- Last visit: Wed Jan 31, 2024 7:03 pm
PS2011 No Private Variable Debug
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.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
PS2011 No Private Variable Debug
I knew you would say that
I am sure there is a hack, but we tend to stick with the official API.
I am sure there is a hack, but we tend to stick with the official API.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.