PSGUI – Debugggingg – HowTo

Hi together,

today i want to show you, how you can debug XAML GUIs created with PSGUI.
And to be honest – this is absolutely easy! You don´t think so? Take a look below.

First of all you should open the PSGUI-Manager


Here you can see some demo GUIs – just select one


Now click on Dialogs – Debug Dialog (or as you can see press CTRL+D)


Afterwards the ISE will be opened with 3 opened files:
Debug-File – contains the debugging statements
ps1-File       – contains your events for the GUI and its objects
psm1-File  –  contains your additional functions


The first one is a dynamically created debug-file to provide you with the 2 relevant statements. The Flag “OnlyCreateVariables” will just create the global variables for all named objects in the GUI.

The variables are named like this:

– for instance in this example:

By using this statement you could code your code and work with the Intellisense.
The other command without this flag is for live debugging. Herefore you have to set the Breakpoint before loading the GUI. (press F9 in the ps1/psm1-File in the specific lines)


Afterwards execute the “debugging line” to load the GUI (for example with F8) and it will stop at your Breakpoints:


At this point you can also prove every command in the command-line below


or the variables with MouseOver on the variables in the code


Try also to go through your code – line by line – by pressing

  • F10 – which will execute the whole line of the actual scope
  • F11  – which will also jump into code of codelines of your actual code
  • Shift + F11 – which will jump out of the code in the actual scope to its parent

And thats it: 

  • Intellisense for better and misstyping-proof coding
  • setting breakpoints and watching variables 
  • testing commands and statements in the CLI
  • live debugging line per line with F10 / F11 / Shift+F11

A little remark here below – please keep in mind that you can debug only one window at a time with a opened ISE instance. Because of this you should open the PSGUI-Manager either with the Link or with Powershell.exe.

Happy debugging and thanks for the read!

Best regards,