Running on a fast machine, if I issue a throw of a user defined exception, it's 6 seconds before the catch in the calling code is called. I wrote an app with nothing but a throw/catch to make sure it wasn't some other problem. This can't be normal. Is there something I'm missing
Dan
Martin Maat [EBL] - 08 Feb 2004 10:49 GMT
> Running on a fast machine, if I issue a throw of a user defined exception, it's 6 seconds before the catch in the calling code is called. I wrote an
app with nothing but a throw/catch to make sure it wasn't some other
problem. This can't be normal. Is there something I'm missing?
Try to change the code so that it will not throw the exception the first
time it passes. Then re-invoke and measure. What probably happens is that
you are measuring a lot of start-ups, JIT compilation and initialisation
time along with your test case.
Martin.
Miha Markic [MVP C#] - 08 Feb 2004 12:16 GMT
Hi,
Are you running under VS.NET?

Signature
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
> Running on a fast machine, if I issue a throw of a user defined exception, it's 6 seconds before the catch in the calling code is called. I wrote an
app with nothing but a throw/catch to make sure it wasn't some other
problem. This can't be normal. Is there something I'm missing?
> Dan
Jon Skeet [C# MVP] - 09 Feb 2004 10:09 GMT
> Running on a fast machine, if I issue a throw of a user defined
> exception, it's 6 seconds before the catch in the calling code is
> called. I wrote an app with nothing but a throw/catch to make sure it
> wasn't some other problem. This can't be normal. Is there something
> I'm missing?
My guess is that you're throwing an instance of ApplicationException
(or a derived class). For some reason, the first time that happens it
*does* seem to take a long time (sometimes - I now can't reproduce it
easily). I suspect it's loading some resources (e.g. error message
translation) into memory.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too