PSEC internally uses the class facility of .NET extensively. These classes, when loaded, set up a complex internal structure with many interdependent pointer references. It is virtually impossible to replace an individual class in such a network of pointers.
This page speaks to the issue - how to replace an existing class with a new class definition.
A primary Powershell window is started that acts as the restarter. The GUI is started as a secondary window.
The GUI facility has 2 modes of running - with a console and with no console. See GUI Modes
The GUI facility starts a new Powershell process and monitors the return code of that process. A special exit code of 901 will trigger the restart logic.
In addition the Form class has a bRestart flag that will invoke the restart logic.
Depending on the GUI Modes, the logic will signal the primary Powershell window to restart the secondary window in the same way as before.
To trigger the restart from a GUI Form the keyboard input looks for a
// keyboard sequence. When seen the restart logic is
invoked. This is used when an underlying class is changed (such as a Flow Task logic).
As a convenience the
.. keyboard sequence closes the window without issuing a restart.
The restart logic trigger specifically looks for a Flow object in
Other GUI systems can also be triggered by adding them to the logic in that module.
PSEC is an extensive set of Powershell enhancements that, along with other acknowledged works, is deployed into the public domain subject to the limitations detailed below.
More detailed information is found by clicking on the link that triggered this popup