This code in CastleLazyInitializer returns generic Exception with a
generic "Target of invoication ..." message. I am rasing
ValidationException in my code yet I cannot catch it as
ValidationException only as Exception. My exception is actually in
innerException. How am I supposed to catch custom exceptions?
/// <summary>
/// Invoke the actual Property/Method using the Proxy or
instantiate
the actual
/// object and use it when the Proxy can't handle the method.
/// </summary>
/// <param name="invocation">The <see cref="IInvocation"/> from
the
generated Castle.DynamicProxy.</param>
public virtual void Intercept(IInvocation invocation)
{
try
{
if (_constructed)
{
// let the generic LazyInitializer
figure out if this can be
handled
// with the proxy or if the real class
needs to be initialized
invocation.ReturnValue =
base.Invoke(invocation.Method,
invocation.Arguments, invocation.Proxy);
// the base LazyInitializer could not
handle it so we need to
Invoke
// the method/property against the real
class
if (invocation.ReturnValue ==
InvokeImplementation)
{
invocation.ReturnValue =
invocation.Method.Invoke
(GetImplementation(), invocation.Arguments);
return;
}
else
{
return;
}
}
else
{
// TODO: Find out equivalent to CGLIB's
'method.invokeSuper'.
return;
}
}
catch (TargetInvocationException tie)
{
// Propagate the inner exception so that the
proxy throws the same
exception as
// the real object would
throw
ReflectHelper.UnwrapTargetInvocationException(tie);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---