"Set-PSDebug -strict" is stopping use of Run & Debug

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
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.
This topic is 3 years and 11 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.
mike_cuff
Posts: 5
Last visit: Thu Feb 29, 2024 8:24 am

"Set-PSDebug -strict" is stopping use of Run & Debug

Post by mike_cuff »

I have created a Forms based project in Powershell Studio, project includes globals.ps1, startup.pss & mainform.psf.

When I include "Set-PSDebug -strict" at top of globals.ps1 I get the following error when trying to run or debug app.

Line 419: The variable '$CommandLine' cannot be retrieved because it has not been set.

However app works fine if I Build to create an exe.

I am using PowerShell studio 5.7.175.

thanks
Mike
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: "Set-PSDebug -strict" is stopping use of Run & Debug

Post by brittneyr »

Using 'Set-PSDebug -Strict' requires that variables must be assigned a value BEFORE being referenced in a script. If a variable is referenced before a value is assigned, PowerShell returns an exception error. Therefore if you are not passing/assigning any value to $Commandline, you will receive an error.
Brittney
SAPIEN Technologies, Inc.
This topic is 3 years and 11 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.