wierd problem happening when debugging and AppDomain.UnhandledException event is handled

  • Thread starter Thread starter Eric Newton
  • Start date Start date
E

Eric Newton

I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line is a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately terminates... no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one
 
update:

I think the 3rd party DLL is crashing the party... its an OCR engine and the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...
 
When the application crashes, is the AppDomain_UnhandledException handler
being called?

HabibH.

Eric Newton said:
update:

I think the 3rd party DLL is crashing the party... its an OCR engine and the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Eric Newton said:
I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line is a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately terminates... no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
Unfortunately not... the process just terminates without prejudice


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Habib Heydarian said:
When the application crashes, is the AppDomain_UnhandledException handler
being called?

HabibH.

Eric Newton said:
update:

I think the 3rd party DLL is crashing the party... its an OCR engine and the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Eric Newton said:
I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line is a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately terminates... no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
still happening... this is getting very frustrating.

i get no exceptions... nothing... even when debugging just crash out

AppDomain.UnhandledException isnt being invoked
System.Windows.Forms.Application.ThreadAbortException isnt being invoked
either

just a silent, fatal, crash

I'm about to go crazy here

Obviously its the 3rd party DLL something crashing the party... but the
problem is I get no warning... just an immediate termination with no chance
to do anything.

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Eric Newton said:
update:

I think the 3rd party DLL is crashing the party... its an OCR engine and the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Eric Newton said:
I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line is a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately terminates... no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
I assume that you don't have access to the source or PDBs for the 3rd party
DLL, correct?

HabibH.

Eric Newton said:
still happening... this is getting very frustrating.

i get no exceptions... nothing... even when debugging just crash out

AppDomain.UnhandledException isnt being invoked
System.Windows.Forms.Application.ThreadAbortException isnt being invoked
either

just a silent, fatal, crash

I'm about to go crazy here

Obviously its the 3rd party DLL something crashing the party... but the
problem is I get no warning... just an immediate termination with no chance
to do anything.

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Eric Newton said:
update:

I think the 3rd party DLL is crashing the party... its an OCR engine and the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Eric Newton said:
I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line is a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately terminates... no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
Have you tried adding a handler to the AppDomain.ProcessExit event? The
third party may be invoking one of the process exit methods.

Another thing you can try for testing is to invoke the 3rd party from a
thread you manually created yourself. The reason is that if an unhandled
exception occurs on the main thread the app will terminate, but if one
occurs on a manual thread the exception is swallowed by the runtime and the
app keeps running.

Also, you can wrap the call to the 3rd party in a try-catch and see if you
get anything.

Eric Newton said:
Unfortunately not... the process just terminates without prejudice


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Habib Heydarian said:
When the application crashes, is the AppDomain_UnhandledException handler
being called?

HabibH.

Eric Newton said:
update:

I think the 3rd party DLL is crashing the party... its an OCR engine
and
the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line is a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately
terminates...
no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
From the visual studio debugger, press CTRL+ALT+ E. On the window which
comes up, select break into the debugger, then press ok. Re-run the
application. It will stop where the crash occurred so you have a better idea
how to fix it. Remember to turn this option back to what it was.

--
Regards,
Alvin Bruney
Got DotNet? Get it here
http://home.networkip.net/dotnet/tidbits/default.htm
Dave said:
Have you tried adding a handler to the AppDomain.ProcessExit event? The
third party may be invoking one of the process exit methods.

Another thing you can try for testing is to invoke the 3rd party from a
thread you manually created yourself. The reason is that if an unhandled
exception occurs on the main thread the app will terminate, but if one
occurs on a manual thread the exception is swallowed by the runtime and the
app keeps running.

Also, you can wrap the call to the 3rd party in a try-catch and see if you
get anything.

Eric Newton said:
Unfortunately not... the process just terminates without prejudice


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Habib Heydarian said:
When the application crashes, is the AppDomain_UnhandledException handler
being called?

HabibH.

update:

I think the 3rd party DLL is crashing the party... its an OCR engine and
the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line
is
a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately
terminates...
no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
unfortunately not. its normal operation doesnt fatal error, but returns
HRESULT-style error codes with error message coming through a byref param.

i've figured out that corrupt TIF files being downloaded from an image
server thats "not quite done assembling the TIF before I try to completely
download it" is causing this OCR engine DLL (that actually interfaces to the
OCR Engine's service process) to just do a Fatal immediate terminate

This is worrysome because the program just terminates unexpectedly without
even giving me the ability to even log the error with a simple "try { }
catch(Exception ex){Debug.WriteLine(ex.ToString()) }"

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]


Habib Heydarian said:
I assume that you don't have access to the source or PDBs for the 3rd party
DLL, correct?

HabibH.

Eric Newton said:
still happening... this is getting very frustrating.

i get no exceptions... nothing... even when debugging just crash out

AppDomain.UnhandledException isnt being invoked
System.Windows.Forms.Application.ThreadAbortException isnt being invoked
either

just a silent, fatal, crash

I'm about to go crazy here

Obviously its the 3rd party DLL something crashing the party... but the
problem is I get no warning... just an immediate termination with no chance
to do anything.

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Eric Newton said:
update:

I think the 3rd party DLL is crashing the party... its an OCR engine
and
the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line is a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately
terminates...
no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
Does the same issue happen if the client application is native C++ rather
than C#?

HabibH.

Eric Newton said:
unfortunately not. its normal operation doesnt fatal error, but returns
HRESULT-style error codes with error message coming through a byref param.

i've figured out that corrupt TIF files being downloaded from an image
server thats "not quite done assembling the TIF before I try to completely
download it" is causing this OCR engine DLL (that actually interfaces to the
OCR Engine's service process) to just do a Fatal immediate terminate

This is worrysome because the program just terminates unexpectedly without
even giving me the ability to even log the error with a simple "try { }
catch(Exception ex){Debug.WriteLine(ex.ToString()) }"

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]


Habib Heydarian said:
I assume that you don't have access to the source or PDBs for the 3rd party
DLL, correct?

HabibH.

Eric Newton said:
still happening... this is getting very frustrating.

i get no exceptions... nothing... even when debugging just crash out

AppDomain.UnhandledException isnt being invoked
System.Windows.Forms.Application.ThreadAbortException isnt being invoked
either

just a silent, fatal, crash

I'm about to go crazy here

Obviously its the 3rd party DLL something crashing the party... but the
problem is I get no warning... just an immediate termination with no chance
to do anything.

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

update:

I think the 3rd party DLL is crashing the party... its an OCR engine and
the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line
is
a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately
terminates...
no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
Dave said:
Have you tried adding a handler to the AppDomain.ProcessExit event? The
third party may be invoking one of the process exit methods.

I have a feeling that a fatal terminate is occurring, and not really a
formal ProcessExit, since it has as part of the call function a ref'd
"errormsg" parameter (i know... lame... anyways) and an HRESULT style return
code... the TIF going into this OCR engine is definitely corrupt which is
probably causing a divide by zero or stack overflow or something really
bad... but I will try to hook into that as well [already hooked into
Applicaiton thread exception and AppDomain unhandled exception] but I fear
that the process is just so fatal that even the CorRuntimeHost is being torn
apart...
Another thing you can try for testing is to invoke the 3rd party from a
thread you manually created yourself. The reason is that if an unhandled
exception occurs on the main thread the app will terminate, but if one
occurs on a manual thread the exception is swallowed by the runtime and the
app keeps running.

This is a good idea... I will try that...
Also, you can wrap the call to the 3rd party in a try-catch and see if you
get anything.

its already in a try-catch but thanks for suggesting... sometimes I can
overlook the obvious...
Eric Newton said:
Unfortunately not... the process just terminates without prejudice


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Habib Heydarian said:
When the application crashes, is the AppDomain_UnhandledException handler
being called?

HabibH.

update:

I think the 3rd party DLL is crashing the party... its an OCR engine and
the
file being passed to it is corrupt [TIFF file that is not expected length]

this is possibly causing the process to Fatal crash... but obviously this
isnt a good situation, since I need to get a chance to at least log the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the line
is
a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately
terminates...
no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
um good question... and I dont really have the C++ skills that I should to
be able to do this quickly, but I would bet that the situation is the
same...

I guess after that, what does one do? I guess the CorRuntimeHost isnt even
getting a chance to respond to the whatever exception is occurring, just
really sucks because theres no opportunity to even write info to a text
file...

Habib Heydarian said:
Does the same issue happen if the client application is native C++ rather
than C#?

HabibH.

Eric Newton said:
unfortunately not. its normal operation doesnt fatal error, but returns
HRESULT-style error codes with error message coming through a byref param.

i've figured out that corrupt TIF files being downloaded from an image
server thats "not quite done assembling the TIF before I try to completely
download it" is causing this OCR engine DLL (that actually interfaces to the
OCR Engine's service process) to just do a Fatal immediate terminate

This is worrysome because the program just terminates unexpectedly without
even giving me the ability to even log the error with a simple "try { }
catch(Exception ex){Debug.WriteLine(ex.ToString()) }"

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]


Habib Heydarian said:
I assume that you don't have access to the source or PDBs for the 3rd party
DLL, correct?

HabibH.

still happening... this is getting very frustrating.

i get no exceptions... nothing... even when debugging just crash out

AppDomain.UnhandledException isnt being invoked
System.Windows.Forms.Application.ThreadAbortException isnt being invoked
either

just a silent, fatal, crash

I'm about to go crazy here

Obviously its the 3rd party DLL something crashing the party... but the
problem is I get no warning... just an immediate termination with no
chance
to do anything.

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

update:

I think the 3rd party DLL is crashing the party... its an OCR
engine
and
the
file being passed to it is corrupt [TIFF file that is not expected
length]

this is possibly causing the process to Fatal crash... but obviously
this
isnt a good situation, since I need to get a chance to at least
log
the
crash...


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

I can't explain why this is happening but here goes

I have a class library being called by a Windows forms app [all
VB.Net],
option strict is ON

before the Application.Run(new frmMain), I call AddHandler
AppDomain.CurrentDomain.UnhandledException, addressof
AppDomain_UnhandledException

theres a call into the class library, several calls down the
line
is
a
P/invoke to a 3rd party DLL

when I step INTO the function it all works

if I step over/run the function the process immediately terminates...
no
warnings, no errors displayed in VS.Net's output

anybody got any ideas? i bet this is gonna be a tough one


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]
 
Back
Top