I think I know what you mean. ;-)
You need to create an additional constructor for your custom exception class
which also contains the inner exception, and calls its base class
constructor with the same signature:
I.e.:
public MyException(string message, Exception inner) : base(message, inner)
{}
When you then throw your custom exception make sure you use this constructor
and put the original Exception in as 2nd parameter. The calling app can then
retrieve the full StackTrace from your inner exception.
Hope that makes sense somehow. :-)
Cheers,
Wim Hollebrandse
--
Wimdows Components
..NET components - professional, robust and affordable.
http://www.wimdows.com
--
"Ghost" <m.********@dur.ac.uk> wrote in message
news:11****************************@phx.gbl...
-----Original Message-----
It there any way to attatch the point of creation of an
error which is thrown in an object to the instance that
caused it to be thrown rather than the throw statement?
.
OK perhaps a little unclear - what I require is that when
the custom exception, that I have already created by
extending the ApplicationException class, is thrown in
the code it is done so by a class which is instantiated
in another class. When the code executes however instead
of referencing the instance of the object that caused the
exception it references the object class its self ie the
trace shows a line number with throw new MyException();
instead of the code for the instance that actually caused
the error.