handling exception thrown from object created from activator class

  • Thread starter Thread starter philipl
  • Start date Start date
P

philipl

hi,

i am having a problem catching a user defined exception, defined in a
class A library on its own, thrown from another class B. I am trying
to catch it in a console app which invokes class B using the Activator
class like this:

instob = Activator.CreateInstance(type, args1);

The problem is that the try block in my console app treats it as an
unhandledexception when i create the object this way, If I
instantiate class B directly then it catches the cutom error without
problems.

Anyone know why this is?
 
I think .NET remoting (Activator) hides the exceptions from the calling library or application.

To see the errors I think you need to use <customErrors mode="off" /> in app.config in <system.runtime.remoting> node.

I guess it does this so that the remote application / library does not reveal details that might leave it open to security issue if it were to return specific error messages...

Hope that helps...
 
Back
Top