Exception unhandled error - but it is...

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Exception unhandled error - but it is...

Post by ic2 »

What am I doing wrong here?
ExceptionUnhandled.jpg
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
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Exception unhandled error - but it is...

Post 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.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: Exception unhandled error - but it is...

Post 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.

Code: Select all

IF !op:HasExited
  op:Kill()
ENDIF
Dick
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Exception unhandled error - but it is...

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: Exception unhandled error - but it is...

Post 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
Post Reply