Exception Not Caught on Production Server

  • Thread starter Thread starter Axel Dahmen
  • Start date Start date
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
 
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.
 
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
 
Back
Top