I'm asking this out of curiosity rather than due to a real need to know, but I can't think of any good reasons for MethodInfo.Invoke
to wrap its exceptions.
Were it to let them pass unwrapped, debugging such exceptions in Visual Studio would be a tiny bit easier - I wouldn't have to ask VS to stop on first-chance exceptions to see the current state at the source of exception. The stack trace would presumably show [external code] just after the call to Invoke
, but so what.
Am I missing some important function that this wrapping provides that would not be possible had Invoke
let exceptions pass unwrapped?