I have an application written in VB.Net. It uses a dll to talk to an
external device. Initially, it was all written in one thread, and it
worked fine. I need to take readings from the external device at
regular intervals, so now when the application loads, I create a
thread that just loops and reads, sleeps.
However, once I make the application multithreaded, the non-reading
thread exits all the time with no apparent reason. It occaisionally
throws a System.ExecutionEngineException which comes up and says that
one of my forms classes is null, but which class varies depending on
the run. Other times, it just exits without any error, unexpectedly.
The classes certainly aren't actually null, as I can sometimes pull up
5 or 6 instances of the form and then the 7th with throw the
exception.
Because the application just quites, I'm having a really hard time
determining where the error is, or how I can troubleshoot it best.
From what I've been able to find out about the
System.ExecutionEngineException, it sounds like it could be a problem
with the dll. But if that is the case, why does it only show up when
I multithread the application?
Can anyone provide some advice on how best to pursue this?
Thanks in advance,
-SC