Page 1 of 1

Stop Unhandled Exception Alert

Posted: Thu Jan 17, 2019 9:11 am
by Crazybyte
Hi all,

I'm wondering if there is any way to totally suppress any Unhandled exception windows error except putting all the code in a try-catch statement.
I have a project with lots of lines and it work properly in any case, but all the times the program run, the followed alert appear. I really would like to avoid it.

Image --> screenshot link

How can I do?

Thanks in advance,

Re: Stop Unhandled Exception Alert

Posted: Thu Jan 17, 2019 9:30 am
by jvierra
What code is causing the exception? This exception looks more like a system error than a PowerShell exception. THe Net Framework is throwing an exception that cannot be trapped by PowerShell.

Re: Stop Unhandled Exception Alert

Posted: Thu Jan 17, 2019 9:58 am
by Crazybyte
I saw there was an 'exit' inside a function. This is the cause, I suppose I cannot use exit inside a form. Do you think I can use jobs to let that function run in background, so when the exit will be executed it will just terminate the job?

Re: Stop Unhandled Exception Alert

Posted: Thu Jan 17, 2019 10:31 am
by jvierra
You can "Close" a form. An "exit" when compiled will throw an exception in the framework.