"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.
mike.cuff
Posts: 1
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Thu Feb 06, 2020 8:17 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: 432
Joined: Thu Jun 01, 2017 7:20 am

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 Ryn
SAPIEN Technologies, Inc.