Exception Not Caught on Production Server

A

Axel Dahmen

Hi,

although I've created a try-catch construct embracing my code, my production
server does not catch an exception like the following:

try
{
string a[]=new string[2];

a[0]=a[2]; -- error
}
catch (SystemException err)
{...}

If run from my debugging server the catch statement is properly executed
during debugging. What did I do wrong?

TIA,
Axel Dahmen
 
K

Kevin Spencer

Try Catching (no pun intended) a System.Exception, rather than a
System.SystemException.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
A

Axel Dahmen

Thanks, Kevin, for trying to help me.

Your solution might be simple, but before I try it, may I ask for curiosity
what the difference is? I.e. what makes my debugging environment catch the
error while my production environment doesn't? Is it perhaps the difference
between .NET 1.0 (dev) and .NET 1.1 (prod)?

I also guess I can't get more "vague" on my exceptions as sometimes I have
to distinguish between them, like:

try
{...}
catch (SqlException err)
{...}
catch (SystemException err)
{...}

Most of the time I actually *want* to react only to particular error
conditions as the error handling code is closely bound to the exception
type. If now I would have to add an additional catch-block to each and every
exception I've written, that would become a not too unimportant overhead
now.

Thanks for enlightening me!

Regards,
Axel Dahmen



------------
Kevin Spencer said:
Try Catching (no pun intended) a System.Exception, rather than a
System.SystemException.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

Axel Dahmen said:
Hi,

although I've created a try-catch construct embracing my code, my
production
server does not catch an exception like the following:

try
{
string a[]=new string[2];

a[0]=a[2]; -- error
}
catch (SystemException err)
{...}

If run from my debugging server the catch statement is properly executed
during debugging. What did I do wrong?

TIA,
Axel Dahmen
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top