wierd behavior - no Exceptions thrown!

S

Sa¹o Zagoranski

Hi...

This is driving me crazy and I really hope I can get an answer...

Take a look at the piece of code below (I'm using .net 2.0):
try
{
double pointTime = XDate.DateTimeToXLDate(point.time);
double pointValue = Convert.ToDouble(point.value);
list.Add(pointTime, pointValue);
}
catch (Exception ex)
{
throw new Exception("Error in function SetFunction", ex);
}

When the application reaches:
double pointValue = Convert.ToDouble(point.value);
it should sometimes throw an exception because I sometimes put in a string
with some text (I will add checking later).
The problem is that this code doesn't throw an exception but it just hangs!
When I added the try/catch block the exception was handled and the catch
block
was reached so I decided to throw another exception just to test things and
now the execution HANGS HERE!!
I should mention the UI is still responsive... I can still run the
application and I can even run the above method with correct
parameters and it works normaly...
It is if the exception is thrown to some secret thread and is "handled"
there...
I added:
Application.ThreadException += new
System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

but the code never reaches these two handlers...

And the same thing happens all over the application (except some parts at
the beginning).

The entire application currently runs on one thread, except for the use of
some System.Windows.Forms.Timer timers (which I don't even start anymore
because I was thinking they are causing the error).
If I try and throw an exception in the beginning of the app it works but
somewhere something has to be set, which triggers such behavior :S and I
don't know what
The problem is that I never before saw such behavior... I don't even know
what to try...

Thanks for any kind of advice...
sa¹o
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top