I created my own behavior as follows:
public class BoundaryExceptionHandlingBehavior : IInterceptionBehavior
{
public IEnumerable<Type> GetRequiredInterfaces()
{
return Type.EmptyTypes;
}
public IMethodReturn Invoke(IMethodInvocation input, GetNextInterceptionBehaviorDelegate getNext)
{
try
{
return getNext()(input, getNext);
}
catch (Exception ex)
{
return null; //this would be something else...
}
}
public bool WillExecute
{
get { return true; }
}
}
I have it setup correctly so that my behavior gets hit as expected. However, if any exception happens in whatever getNext() does, it doesn't hit my catch block. Can anyone clarify why? I'm not really looking to solve the problem as there's many ways to deal with exceptions, it's more that I don't understand what's going on, and I'd like to.