valdis99
10-13-2005, 05:24 PM
I have a question regarding exceptions and proxied objects.
I have defined a proxied object which can throw a (subclass of ) System.Exception. This proxy is injected via the IoC container into my "service" object. If the proxied object throws the exception, a TargetInvocationException is returned to my service class, with the InnerException set as the thrown exception.
However, if I add a IThrowsAdvice which simply logs the custom exception via log4net, my "service" class receives the real thrown exception, typed correctly.
Is this expected behavior or a bug? I wouldn't expect that I'd have to catch a TargetInvocationException in my "service" class.
I have defined a proxied object which can throw a (subclass of ) System.Exception. This proxy is injected via the IoC container into my "service" object. If the proxied object throws the exception, a TargetInvocationException is returned to my service class, with the InnerException set as the thrown exception.
However, if I add a IThrowsAdvice which simply logs the custom exception via log4net, my "service" class receives the real thrown exception, typed correctly.
Is this expected behavior or a bug? I wouldn't expect that I'd have to catch a TargetInvocationException in my "service" class.