Re: Custom exception and JIT debugging

From: David Levine (noSpamdlevineNNTP2_at_wi.rr.com)
Date: 08/25/04


Date: Wed, 25 Aug 2004 14:15:38 -0500

Assuming all things being equal you should get the same fundamental behavior
regardless of the build type. IOW, if it's unhandled in a release build it
should be unhandled in a debug build. How the system responds to an
unhandled exception may differ between builds but not whether it is
unhandled or handled in a catch handler.

That implies that you may be seeing an artifact of the environment, i.e. the
debug environment may be different then the release environment; e.g. where
the assemblies are located may be different. This can cause problems in the
client code that catches the exception. When the exception is caught the
runtime must be capable of resolving the type by locating the assembly the
type is defined in. If the type used in the client is defined in an assembly
located in a different directory then the assembly used in the server code
that throws the exception then the runtime will treat them as two distinct
types. In this case the catch block will either not catch the exception
(resulting in an unhandled exception), or when it tries to deserialize or
access the exception object it may cause a TypeCast exception, or some other
exception, nested within the original exception.

So I would look for duplicate copies of the assembly that defines the custom
exception. If you have more then 1 copy that the client can bind to it could
cause this problem.

"saurabh" <saurabh@nagpurcity.net> wrote in message
news:eI6T%23loiEHA.3428@TK2MSFTNGP11.phx.gbl...
> They are in different assemblies. The stack trace is exactly same as I get
> in the exception object on my development machine. Can you tell me under
> what conditions the JIT debugger thinks it needs to kick in?
>
> --Saurabh
>
> "David Levine" <noSpamdlevineNNTP2@wi.rr.com> wrote in message
> news:ecQtI1XiEHA.1356@TK2MSFTNGP09.phx.gbl...
> > Is this all housed within a single assembly, or is the assembly that the
> > exception is defined different then the assembly that catches it? Also,
> what
> > does the stack trace say?
> >
> > "saurabh" <saurabh@nagpurcity.net> wrote in message
> > news:eAi93rQiEHA.2400@tk2msftngp13.phx.gbl...
> > > Hello All,
> > >
> > > In my application I have created a custom exception class derived from
> > > ApplicationException. For a particular error condition, I throw this
> > > exception. In the calling code, I catch this exception and report the
> > error
> > > condition. This all works fine on my development machine (as always
;))
> > but
> > > on the release machine, the exception is not reported but it launches
> the
> > > JIT debugger nasty dialog saying 'unhandled exception'
> > >
> > > Has anybody experienced anything like this? Any help in resolving this
> > issue
> > > is highly appreciated.
> > >
> > > TIA,
> > >
> > > --Saurabh
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Can RCW and CCW be used together?
    ... code that you show seems to be VB6 code, but the exception must be thrown ... component project reference to my client project and build. ... problem-domain specific assemblies and the assemblies for the RCW-Interop ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Remoting, AppDomains, and Exceptions
    ... > 2) Be sure to catch all exceptions coming from the second AppDomain and, ... > InnerException), raise a new exception and copy the message over. ... >> independant assemblies which expose methods to the client. ...
    (microsoft.public.dotnet.framework.remoting)
  • UnhandledExceptionHandler delegate not working in remoting host
    ... But I'd like to catch any unhandled exceptions that occur in any of the actual assemblies being used by client applications. ... This exception is being raised - it's getting back to the client application - but my UnhandledException delegate isn't being called. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: EventLogPermission via caspol.exe
    ... I moved my code off UNC to local disk. ... Exception oInnerException, Boolean bLog) ... > web app and assemblies over UNC. ...
    (microsoft.public.dotnet.security)
  • Re: EventLogPermission via caspol.exe
    ... I moved my code off UNC to local disk. ... Exception oInnerException, Boolean bLog) ... > web app and assemblies over UNC. ...
    (microsoft.public.dotnet.framework.aspnet.security)