uncatchable exception?

  • Thread starter Thread starter cs
  • Start date Start date
C

cs

We have some code that walks the process tree on windows xp. It uses the
process class in system diagnostic as well as some dllimport calls to
kernel32.dll and ntdll.dll
We also have some code that talks on terminal services virtual channels
using wtsapi32.dll

What we have noticed is that after calling those methods several times
per minute in some cases or at least lots of times per hour all day long
will end up giving a "application has generated an exception that could
not be handled" dialog with a ok and cancel button. Tonight I have
researched and someone suggests using cordbg, so I will try that next.
What I am actually wondering is how can that error show up if I have
some huge TRY-CATCHES around any calls to those lines of code? I am
almost certain its those lines of code that make it fail because I
output to my logs before and after calling methods on those dlls and the
error always happens right after the log says its getting ready to call
one of those methods. So is there some special TRY-CATCH for dll imports
maybe? BTW if I do pass the wrong params or something to those methods I
do get a nice exception I can catch, its just sometimes that I get that
error that I can't do anything about!


Thanks,
 
cs said:
We have some code that walks the process tree on windows xp. It uses
the process class in system diagnostic as well as some dllimport
calls to kernel32.dll and ntdll.dll We also have some code that talks
on terminal services virtual channels using wtsapi32.dll

What we have noticed is that after calling those methods several
times per minute in some cases or at least lots of times per hour all
day long will end up giving a "application has generated an exception
that could not be handled" dialog with a ok and cancel button.
Tonight I have researched and someone suggests using cordbg, so I
will try that next. What I am actually wondering is how can that
error show up if I have some huge TRY-CATCHES around any calls to
those lines of code? I am almost certain its those lines of code that
make it fail because I output to my logs before and after calling
methods on those dlls and the error always happens right after the
log says its getting ready to call one of those methods. So is there
some special TRY-CATCH for dll imports maybe? BTW if I do pass the
wrong params or something to those methods I do get a nice exception
I can catch, its just sometimes that I get that error that I can't do
anything about!

Maybe you're dealing with a non-CLS-compliant exception. Do have a
general catch clause in your code as well, e.g. something like
try
{
DoDangerousThings();
}
catch
{
// Yada yada
}

Cheers,
 
Joerg said:
cs wrote:




Maybe you're dealing with a non-CLS-compliant exception. Do have a
general catch clause in your code as well, e.g. something like
try
{
DoDangerousThings();
}
catch
{
// Yada yada
}

Cheers,

I almost always have a catch(Exception ex) at the end of all my catches,
is it still necessary to have a catch without an exception in it?
 
Joerg said:
cs wrote:




Maybe you're dealing with a non-CLS-compliant exception. Do have a
general catch clause in your code as well, e.g. something like
try
{
DoDangerousThings();
}
catch
{
// Yada yada
}

Cheers,

I almost always have a catch(Exception ex) at the end of all my catches,
is it still necessary to have a catch without an exception in it?
 
Joerg said:
cs wrote:




Maybe you're dealing with a non-CLS-compliant exception. Do have a
general catch clause in your code as well, e.g. something like
try
{
DoDangerousThings();
}
catch
{
// Yada yada
}

Cheers,

I almost always have a catch(Exception ex) at the end of all my catches,
is it still necessary to have a catch without an exception in it?
 
Joerg said:
cs wrote:




Maybe you're dealing with a non-CLS-compliant exception. Do have a
general catch clause in your code as well, e.g. something like
try
{
DoDangerousThings();
}
catch
{
// Yada yada
}

Cheers,

I almost always have a catch(Exception ex) at the end of all my catches,
is it still necessary to have a catch without an exception in it?
 
Maybe you're dealing with a non-CLS-compliant exception. Do have a
I almost always have a catch(Exception ex) at the end of all my catches,
is it still necessary to have a catch without an exception in it?

Non-CLS compliant exceptions can only be thrown by code which is able to
generate native exceptions or exception not based on System.Exception. This
could be native code or also managed C++.
 
Back
Top