473,624 Members | 2,238 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

First exception is very slow...

I've noticed that the first exception thrown/caught by an app running in
debug is very slow - it takes perhaps 7 or 8 seconds on my P4 machine. I've
noticed this on several different machines running the development
environment.

To replicate, create a new c# windows app, add a button, and hook it to the
following code:
private void btnException_Cl ick(object sender, System.EventArg s e)
{
try
{
throw new ApplicationExce ption("Exceptio n!!!");
}
catch(Exception ex)
{
MessageBox.Show (ex.ToString()) ;
}
}

Run the app in debug (F5), click on the button, and wait about 5-10 sec. for
the message box to appear. Clicking a second time causes the message box to
appear immediately.

Can anyone tell me what's causing this, and is there a solution/workaround?

Thanks.

--
Rob Gravereaux
Principal Developer
Glen Road Systems, Inc.
Ro************* *******@grsinc. com
http://www.grsinc.com
Nov 15 '05 #1
8 1951
Robert,

Catching exceptions is always a more expensive operation. The runtime
might hold of until a first occurance in order to save some time. The only
way I can think of to get around this would be to create a new thread,
throwing and catching an exception on that thread, and then exiting.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I've noticed that the first exception thrown/caught by an app running in
debug is very slow - it takes perhaps 7 or 8 seconds on my P4 machine. I've noticed this on several different machines running the development
environment.

To replicate, create a new c# windows app, add a button, and hook it to the following code:
private void btnException_Cl ick(object sender, System.EventArg s e)
{
try
{
throw new ApplicationExce ption("Exceptio n!!!");
}
catch(Exception ex)
{
MessageBox.Show (ex.ToString()) ;
}
}

Run the app in debug (F5), click on the button, and wait about 5-10 sec. for the message box to appear. Clicking a second time causes the message box to appear immediately.

Can anyone tell me what's causing this, and is there a solution/workaround?
Thanks.

--
Rob Gravereaux
Principal Developer
Glen Road Systems, Inc.
Ro************* *******@grsinc. com
http://www.grsinc.com

Nov 15 '05 #2
Thanks for the reply.

It only happens when running apps in debug in the IDE. It does not occur if
I run the compiled executable, so I don't think I'd want to add additional
code if possible.

Is this behaviour affected by any of the settings of the debugger?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Robert,

Catching exceptions is always a more expensive operation. The runtime
might hold of until a first occurance in order to save some time. The only way I can think of to get around this would be to create a new thread,
throwing and catching an exception on that thread, and then exiting.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I've noticed that the first exception thrown/caught by an app running in
debug is very slow - it takes perhaps 7 or 8 seconds on my P4 machine.

I've
noticed this on several different machines running the development
environment.

To replicate, create a new c# windows app, add a button, and hook it to

the
following code:
private void btnException_Cl ick(object sender, System.EventArg s e)
{
try
{
throw new ApplicationExce ption("Exceptio n!!!");
}
catch(Exception ex)
{
MessageBox.Show (ex.ToString()) ;
}
}

Run the app in debug (F5), click on the button, and wait about 5-10 sec.

for
the message box to appear. Clicking a second time causes the message box

to
appear immediately.

Can anyone tell me what's causing this, and is there a

solution/workaround?

Thanks.

--
Rob Gravereaux
Principal Developer
Glen Road Systems, Inc.
Ro************* *******@grsinc. com
http://www.grsinc.com


Nov 15 '05 #3
Robert,

Of course! The fact that it is being debugged in the first place
changes a lot. You have one process basically hooking into another process
as it is executing code. I can't imagine that there ^wouldn't^ be any
overhead involved in this process, as well as initialization and tear-down
code.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Thanks for the reply.

It only happens when running apps in debug in the IDE. It does not occur if I run the compiled executable, so I don't think I'd want to add additional
code if possible.

Is this behaviour affected by any of the settings of the debugger?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Robert,

Catching exceptions is always a more expensive operation. The runtime might hold of until a first occurance in order to save some time. The

only
way I can think of to get around this would be to create a new thread,
throwing and catching an exception on that thread, and then exiting.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I've noticed that the first exception thrown/caught by an app running in debug is very slow - it takes perhaps 7 or 8 seconds on my P4 machine.

I've
noticed this on several different machines running the development
environment.

To replicate, create a new c# windows app, add a button, and hook it
to the
following code:
private void btnException_Cl ick(object sender, System.EventArg s e)
{
try
{
throw new ApplicationExce ption("Exceptio n!!!");
}
catch(Exception ex)
{
MessageBox.Show (ex.ToString()) ;
}
}

Run the app in debug (F5), click on the button, and wait about 5-10
sec. for
the message box to appear. Clicking a second time causes the message
box to
appear immediately.

Can anyone tell me what's causing this, and is there a

solution/workaround?

Thanks.

--
Rob Gravereaux
Principal Developer
Glen Road Systems, Inc.
Ro************* *******@grsinc. com
http://www.grsinc.com



Nov 15 '05 #4
OK, I'll accept that, in general. however 5 - 10 seconds seems excessive,
and for the 5 - 10 seconds I'm waiting nothing appears to be happening, i.e.
no disk activity, no libraries appear to be loading, etc...

For kicks I ran the same code in debug in VS.Net 2002 on the same machine
and I get what I'd expect - the catch block is executed immediately the
first time. So I still think my issue is valid. I guess this is either a
configuration issue in VS.Net 2003 or, dare I say it, a bug.

Can you replicate this behaviour in your environment? I can't believe this
is 'normal' for VS.Net 2003, yet it happens on every install I have.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:OI******** ******@TK2MSFTN GP09.phx.gbl...
Robert,

Of course! The fact that it is being debugged in the first place
changes a lot. You have one process basically hooking into another process as it is executing code. I can't imagine that there ^wouldn't^ be any
overhead involved in this process, as well as initialization and tear-down
code.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Thanks for the reply.

It only happens when running apps in debug in the IDE. It does not occur if
I run the compiled executable, so I don't think I'd want to add additional
code if possible.

Is this behaviour affected by any of the settings of the debugger?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote

in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Robert,

Catching exceptions is always a more expensive operation. The

runtime might hold of until a first occurance in order to save some time. The

only
way I can think of to get around this would be to create a new thread,
throwing and catching an exception on that thread, and then exiting.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> I've noticed that the first exception thrown/caught by an app running in
> debug is very slow - it takes perhaps 7 or 8 seconds on my P4
machine. I've
> noticed this on several different machines running the development
> environment.
>
> To replicate, create a new c# windows app, add a button, and hook it

to the
> following code:
> private void btnException_Cl ick(object sender, System.EventArg s e)
> {
> try
> {
> throw new ApplicationExce ption("Exceptio n!!!");
> }
> catch(Exception ex)
> {
> MessageBox.Show (ex.ToString()) ;
> }
> }
>
> Run the app in debug (F5), click on the button, and wait about 5-10 sec. for
> the message box to appear. Clicking a second time causes the message box to
> appear immediately.
>
> Can anyone tell me what's causing this, and is there a
solution/workaround?
>
> Thanks.
>
> --
> Rob Gravereaux
> Principal Developer
> Glen Road Systems, Inc.
> Ro************* *******@grsinc. com
> http://www.grsinc.com
>
>



Nov 15 '05 #5
Robert,

If you email me a zipped project, I can take a look at it on my machine.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:O7******** ******@TK2MSFTN GP11.phx.gbl...
OK, I'll accept that, in general. however 5 - 10 seconds seems excessive,
and for the 5 - 10 seconds I'm waiting nothing appears to be happening, i.e. no disk activity, no libraries appear to be loading, etc...

For kicks I ran the same code in debug in VS.Net 2002 on the same machine
and I get what I'd expect - the catch block is executed immediately the
first time. So I still think my issue is valid. I guess this is either a
configuration issue in VS.Net 2003 or, dare I say it, a bug.

Can you replicate this behaviour in your environment? I can't believe this
is 'normal' for VS.Net 2003, yet it happens on every install I have.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:OI******** ******@TK2MSFTN GP09.phx.gbl...
Robert,

Of course! The fact that it is being debugged in the first place
changes a lot. You have one process basically hooking into another

process
as it is executing code. I can't imagine that there ^wouldn't^ be any
overhead involved in this process, as well as initialization and tear-down
code.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Thanks for the reply.

It only happens when running apps in debug in the IDE. It does not occur
if
I run the compiled executable, so I don't think I'd want to add additional code if possible.

Is this behaviour affected by any of the settings of the debugger?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om>
wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> Robert,
>
> Catching exceptions is always a more expensive operation. The

runtime
> might hold of until a first occurance in order to save some time.
The only
> way I can think of to get around this would be to create a new thread, > throwing and catching an exception on that thread, and then exiting.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard. caspershouse.co m
>
> "Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in

message > news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> > I've noticed that the first exception thrown/caught by an app running
in
> > debug is very slow - it takes perhaps 7 or 8 seconds on my P4

machine. > I've
> > noticed this on several different machines running the development
> > environment.
> >
> > To replicate, create a new c# windows app, add a button, and hook

it to
> the
> > following code:
> > private void btnException_Cl ick(object sender, System.EventArg s e)
> > {
> > try
> > {
> > throw new ApplicationExce ption("Exceptio n!!!");
> > }
> > catch(Exception ex)
> > {
> > MessageBox.Show (ex.ToString()) ;
> > }
> > }
> >
> > Run the app in debug (F5), click on the button, and wait about
5-10 sec.
> for
> > the message box to appear. Clicking a second time causes the
message box
> to
> > appear immediately.
> >
> > Can anyone tell me what's causing this, and is there a
> solution/workaround?
> >
> > Thanks.
> >
> > --
> > Rob Gravereaux
> > Principal Developer
> > Glen Road Systems, Inc.
> > Ro************* *******@grsinc. com
> > http://www.grsinc.com
> >
> >
>
>



Nov 15 '05 #6
Robert,

I am getting approximately the same results (3 seconds on the first one,
none on the subsequent calls). I can only guess, but I imagine it has
something to do with the way that the CLR exposes debugging functionality,
and possibly with the way that VS.NET hooks up with the CLR for debugging,
and the possibility of those things changing between .NET 1.0 and .NET 1.1.

However, when running a release version, I do not get this.

Given that the versions we run are debug versions, I can't say I am
extremely concerned. I can ask around why this might happen though, and
post if I find anything.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Here's a sample app. It's the same code from my first posting, with the
addition of some timing code.

Please run it in debug from the VS.Net 2003 IDE, click the button and wait. On my environments the first exception takes anywhere from 3 to 10 seconds
to be caught. After that it's immediate.

In VS.Net 2002 the first exception is caught immediately.

Let me know what your times are.

Thanks.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:O8******** ******@TK2MSFTN GP11.phx.gbl...
Robert,

If you email me a zipped project, I can take a look at it on my machine.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:O7******** ******@TK2MSFTN GP11.phx.gbl...
OK, I'll accept that, in general. however 5 - 10 seconds seems excessive, and for the 5 - 10 seconds I'm waiting nothing appears to be happening,
i.e.
no disk activity, no libraries appear to be loading, etc...

For kicks I ran the same code in debug in VS.Net 2002 on the same machine and I get what I'd expect - the catch block is executed immediately
the first time. So I still think my issue is valid. I guess this is either a configuration issue in VS.Net 2003 or, dare I say it, a bug.

Can you replicate this behaviour in your environment? I can't believe this is 'normal' for VS.Net 2003, yet it happens on every install I have.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:OI******** ******@TK2MSFTN GP09.phx.gbl...
> Robert,
>
> Of course! The fact that it is being debugged in the first
place > changes a lot. You have one process basically hooking into another
process
> as it is executing code. I can't imagine that there ^wouldn't^ be any > overhead involved in this process, as well as initialization and

tear-down
> code.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard. caspershouse.co m
>
> "Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message > news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> > Thanks for the reply.
> >
> > It only happens when running apps in debug in the IDE. It does not

occur
> if
> > I run the compiled executable, so I don't think I'd want to add
additional
> > code if possible.
> >
> > Is this behaviour affected by any of the settings of the debugger?
> >
> > "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om>

wrote
> in
> > message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> > > Robert,
> > >
> > > Catching exceptions is always a more expensive operation. The > runtime
> > > might hold of until a first occurance in order to save some
time. The
> > only
> > > way I can think of to get around this would be to create a new

thread,
> > > throwing and catching an exception on that thread, and then

exiting. > > >
> > > Hope this helps.
> > >
> > >
> > > --
> > > - Nicholas Paldino [.NET/C# MVP]
> > > - mv*@spam.guard. caspershouse.co m
> > >
> > > "Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in
message
> > > news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> > > > I've noticed that the first exception thrown/caught by an app
running
> in
> > > > debug is very slow - it takes perhaps 7 or 8 seconds on my P4
machine.
> > > I've
> > > > noticed this on several different machines running the development > > > > environment.
> > > >
> > > > To replicate, create a new c# windows app, add a button, and hook
it
> to
> > > the
> > > > following code:
> > > > private void btnException_Cl ick(object sender,

System.EventArg s e) > > > > {
> > > > try
> > > > {
> > > > throw new ApplicationExce ption("Exceptio n!!!");
> > > > }
> > > > catch(Exception ex)
> > > > {
> > > > MessageBox.Show (ex.ToString()) ;
> > > > }
> > > > }
> > > >
> > > > Run the app in debug (F5), click on the button, and wait about

5-10
> sec.
> > > for
> > > > the message box to appear. Clicking a second time causes the

message
> box
> > > to
> > > > appear immediately.
> > > >
> > > > Can anyone tell me what's causing this, and is there a
> > > solution/workaround?
> > > >
> > > > Thanks.
> > > >
> > > > --
> > > > Rob Gravereaux
> > > > Principal Developer
> > > > Glen Road Systems, Inc.
> > > > Ro************* *******@grsinc. com
> > > > http://www.grsinc.com
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #7
I'd appreciate anything you can find out.

Thanks for the effort.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:ug******** ******@tk2msftn gp13.phx.gbl...
Robert,

I am getting approximately the same results (3 seconds on the first one, none on the subsequent calls). I can only guess, but I imagine it has
something to do with the way that the CLR exposes debugging functionality,
and possibly with the way that VS.NET hooks up with the CLR for debugging,
and the possibility of those things changing between .NET 1.0 and .NET 1.1.
However, when running a release version, I do not get this.

Given that the versions we run are debug versions, I can't say I am
extremely concerned. I can ask around why this might happen though, and
post if I find anything.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Here's a sample app. It's the same code from my first posting, with the
addition of some timing code.

Please run it in debug from the VS.Net 2003 IDE, click the button and wait.
On my environments the first exception takes anywhere from 3 to 10 seconds
to be caught. After that it's immediate.

In VS.Net 2002 the first exception is caught immediately.

Let me know what your times are.

Thanks.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote

in
message news:O8******** ******@TK2MSFTN GP11.phx.gbl...
Robert,

If you email me a zipped project, I can take a look at it on my

machine.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in message news:O7******** ******@TK2MSFTN GP11.phx.gbl...
> OK, I'll accept that, in general. however 5 - 10 seconds seems

excessive,
> and for the 5 - 10 seconds I'm waiting nothing appears to be happening, i.e.
> no disk activity, no libraries appear to be loading, etc...
>
> For kicks I ran the same code in debug in VS.Net 2002 on the same

machine
> and I get what I'd expect - the catch block is executed immediately the > first time. So I still think my issue is valid. I guess this is either a
> configuration issue in VS.Net 2003 or, dare I say it, a bug.
>
> Can you replicate this behaviour in your environment? I can't
believe this
> is 'normal' for VS.Net 2003, yet it happens on every install I have.
>
> "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om>

wrote in
> message news:OI******** ******@TK2MSFTN GP09.phx.gbl...
> > Robert,
> >
> > Of course! The fact that it is being debugged in the first place > > changes a lot. You have one process basically hooking into
another > process
> > as it is executing code. I can't imagine that there ^wouldn't^ be

any > > overhead involved in this process, as well as initialization and
tear-down
> > code.
> >
> >
> > --
> > - Nicholas Paldino [.NET/C# MVP]
> > - mv*@spam.guard. caspershouse.co m
> >
> > "Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in

message
> > news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> > > Thanks for the reply.
> > >
> > > It only happens when running apps in debug in the IDE. It does not occur
> > if
> > > I run the compiled executable, so I don't think I'd want to add
> additional
> > > code if possible.
> > >
> > > Is this behaviour affected by any of the settings of the debugger? > > >
> > > "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
> > in
> > > message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> > > > Robert,
> > > >
> > > > Catching exceptions is always a more expensive operation. The > > runtime
> > > > might hold of until a first occurance in order to save some time. The
> > > only
> > > > way I can think of to get around this would be to create a new
thread,
> > > > throwing and catching an exception on that thread, and then

exiting.
> > > >
> > > > Hope this helps.
> > > >
> > > >
> > > > --
> > > > - Nicholas Paldino [.NET/C# MVP]
> > > > - mv*@spam.guard. caspershouse.co m
> > > >
> > > > "Robert Gravereaux" <Ro************ ********@grsinc .com> wrote in > message
> > > > news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> > > > > I've noticed that the first exception thrown/caught by an app > running
> > in
> > > > > debug is very slow - it takes perhaps 7 or 8 seconds on my P4 > machine.
> > > > I've
> > > > > noticed this on several different machines running the

development
> > > > > environment.
> > > > >
> > > > > To replicate, create a new c# windows app, add a button, and

hook
it
> > to
> > > > the
> > > > > following code:
> > > > > private void btnException_Cl ick(object sender,

System.EventArg s
e)
> > > > > {
> > > > > try
> > > > > {
> > > > > throw new ApplicationExce ption("Exceptio n!!!");
> > > > > }
> > > > > catch(Exception ex)
> > > > > {
> > > > > MessageBox.Show (ex.ToString()) ;
> > > > > }
> > > > > }
> > > > >
> > > > > Run the app in debug (F5), click on the button, and wait about 5-10
> > sec.
> > > > for
> > > > > the message box to appear. Clicking a second time causes the
message
> > box
> > > > to
> > > > > appear immediately.
> > > > >
> > > > > Can anyone tell me what's causing this, and is there a
> > > > solution/workaround?
> > > > >
> > > > > Thanks.
> > > > >
> > > > > --
> > > > > Rob Gravereaux
> > > > > Principal Developer
> > > > > Glen Road Systems, Inc.
> > > > > Ro************* *******@grsinc. com
> > > > > http://www.grsinc.com
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #8
Robert Gravereaux <Ro************ ********@grsinc .com> wrote:
Here's a sample app. It's the same code from my first posting, with the
addition of some timing code.

Please run it in debug from the VS.Net 2003 IDE, click the button and wait.
On my environments the first exception takes anywhere from 3 to 10 seconds
to be caught. After that it's immediate.

In VS.Net 2002 the first exception is caught immediately.

Let me know what your times are.


It's just over a second for me. I noted that during that second, the
CPU is busy - so it's not like the machine is just waiting or anything.

Here's a rather simpler program to demonstrate it - less GUI fluff to
get in the way:

using System;

class Test
{
static void Main(string[] args)
{
DateTime start = DateTime.Now;
try
{
throw new ApplicationExce ption("Hello");
}
catch (Exception)
{
DateTime end = DateTime.Now;
Console.WriteLi ne(end-start);
}
Console.ReadLin e();
}
}

Now, the interesting thing is that if you change ApplicationExce ption
to Exception, the delay goes away.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
2172
by: DotNetIsHorrible | last post by:
I write CRUD database applications for a living for an audience of about 100 users per application using classic ASP. I maintain and frequently change on user's request 22 different applications by myself. Recently we have had .NET 1.1 then 2.0 installed and have been told to use it. After reading the books about it, and trying it for a couple of months, I got so mad I decided to write down all of my issues and rants and post them here....
7
1556
by: Earl Teigrob | last post by:
The first time any of my web apps are hit, they take a long time (45 seconds) for the JIT compiler to compile them. After being hit the first time, they are very fast. My boss is starting to think that .NET is crap because every time he goes to hit the Intranet, it takes so long to compile the code. I am running the apps on a windows 2003 server, which appears to dump cached code very promptly after 20 minutes of inactivity (when all the...
6
3537
by: cameron | last post by:
I have always been under the impression that LDAP was optimized for speed. Fast queries, fast access, slower writes. I have a block of data in LDAP and in SQL. Exact same data. The query is fast but the first access to the result set takes longer that to do the query in SQL and process the sql results. From my trace.axd LDAP Test Starting Search 0.000112 0.000043 LDAP Test Done Search 0.003821 0.003374 <--- fast query at .003 sec LDAP...
3
1265
by: Bob Graham | last post by:
This code: txRate.Text = Format(payRate, "C") (payRate is already succesfully set to a value such as 15D) takes about 3-4 seconds to run the first time, after that it's plenty fast. What makes it slow on the first call? Bob Graham
7
1710
by: Yarco | last post by:
Well, friend. Yes, I'm doing PHP. But exception is a traditional machinism in programming languages. I'm very doubt about this. In procedure language, we return error code when we meet an error. So we need to design error code table and judge them in several statements. Finally they become boring. But how about use exception in OOP? Did we drop all "return error code" styles? If i want to fetch a webpage: <?php
1
4533
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
We have hosted a web application in a client network and the application is responding very slow. In between we are getting exceptions due to the request time out. We are getting the following exceptions: 1. Event Message : Request has been aborted. Exception Type : HttpException Exception Message : Request timed out
9
13030
by: SAL | last post by:
I have an ASP.NET 2.0 app that takes about 17 seconds to load on first startup but then is very fast after that. As I understand it from some posts in June, this is caused by the loading of the App Domain. We have both Cold Fusion and ASP.NET apps on this server and the Cold Fusion apps do not display such slowness on their first start up of the day. Is there a way to improve the load times of ASP.NET apps? I'm having to justify to my boss...
2
4710
by: Cramer | last post by:
I'm developing a new ASP.NET 3.5 app and I have an http module hooked up to Application_Error that logs detailed exception data. When it parses and evaluates unhandled exceptions, it "sees" all exceptions as type "System.Web.HttpUnhandledException", with the message: "Exception of type 'System.Web.HttpUnhandledException' was thrown." At the same time and for the exact same exception, on my development computer, ASP.NET shows a very...
0
1560
Frinavale
by: Frinavale | last post by:
I have a peculiar problem... Background: I have a function that I don't want the user to execute more than once while they are waiting for it to process; therefore, I disable all of the controls on the page via some JavaScript before the request is sent. This function takes some time to execute because it has to communicate with hardware that is rather slow. This slowness combined with a little bit of lag sometimes results in a ...
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6108
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.