"break" "exit" casue gui error -Unhandled Exception

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 6 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.
Locked
clarkhsu
Posts: 1
Last visit: Fri Mar 03, 2023 6:39 am

"break" "exit" casue gui error -Unhandled Exception

Post by clarkhsu »

Hi all,
I tried to convert some script code from ps1 to psf , when "break" or "exit" is used in code which will cause system error
is there any workaround to stop the code running?
thanks




See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Management.Automation.ExitException: System error.
Attachments
2021-09-03_115207.jpg
2021-09-03_115207.jpg (76.83 KiB) Viewed 2868 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: "break" "exit" casue gui error -Unhandled Exception

Post by jvierra »

Sorry but the information posted does not give us enough to understand what you are trying to ask.

You cannot debug or run a PSF. Under PSS 'Run" or "Debug" generates a PS1 and executes it in a separate host. YOu cannot debug through PSS with an external JIT debugger without creating conflicts. Why would you want to run an external debugger?

The message is from teh Windows system and is notifying you that the code run has thrown an exception that you haven't handled.

Trying to exit a form when another event is in progresss will throw an exception. Do not use "break" or "exit" in a form except when "break" is in a loop structure.

To stop a form just "Close" it and the form will end as long as it is not in a long loop in some event.
This topic is 2 years and 6 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.
Locked