Page 1 of 1
Exception unhandled error - but it is...
Posted: Tue Nov 28, 2023 9:36 pm
by ic2
What am I doing wrong here?
I know why the op:Kill line can fail. That's why I embedded it in a TRY-CATCH, so it would silently continue there. But it doesn't. It comes up with the JIT window, or this "unhandled exception" on debugging. I'd say it
is handled...
What do I miss?
Dick
Re: Exception unhandled error - but it is...
Posted: Wed Nov 29, 2023 7:51 am
by Chris
Hi Dick,
There are a few exceptions which cannot be caught and continue program execution, because the problem that caused them might have unsettles the runtime environment, caused a memory corruption or similar causes. One notable example is the StackOverflowException or the invalid operation/memory read/write exceptions.
From the screenshot you posted I can't tell why the exception happened, but the message sounds like it falls into one of the categories I mentioned above.
Re: Exception unhandled error - but it is...
Posted: Wed Nov 29, 2023 8:20 pm
by ic2
Thanks Chris for explaining this. I've found the cause and a solution.
I use ProcessStartInfo to start an executable which displays a modern type of busyindicator. Earlier I tried to do this from the program but whatever I tried, the animation did not start until after the waiting time it was supposed to 'entertain' the user. This way it works but the process must be killed after that waiting time. Now I found out that (only) in my test directory the executable didn't start. Some DLL mismatch, no doubt, and Microsofts Event View message confirms this with a Exception Info: System.IO.FileNotFoundException (note: didn't the guys who wrote this think it would be a good idea to also report
which file wasn't found - or is a mismatch).
Apparently that is the same situation as when the process already stopped and this then helps to prevent the Kill() running and giving the exception.
Dick
Re: Exception unhandled error - but it is...
Posted: Thu Nov 30, 2023 7:38 am
by robert
Dick,
The FileNotFoundException class has a property with the filename that was not found:
https://learn.microsoft.com/en-us/dotne ... mework-4.8
Robert
Re: Exception unhandled error - but it is...
Posted: Thu Nov 30, 2023 11:41 am
by ic2
Then the question is why the Microsoft programmers who created the additions to the Microsoft Event log are apparently unaware of this method and hence did not enter a filename in that log, together with the error. Which means the log entry as it is now is as good as useless.
Dick