diff --git a/ManagedUiaCustomizationCore/Schema/UiaMethodInfoHelper.cs b/ManagedUiaCustomizationCore/Schema/UiaMethodInfoHelper.cs index 062f445..31eee04 100644 --- a/ManagedUiaCustomizationCore/Schema/UiaMethodInfoHelper.cs +++ b/ManagedUiaCustomizationCore/Schema/UiaMethodInfoHelper.cs @@ -161,7 +161,17 @@ public void DispatchCallToProvider(object provider, UiaParameterListHelper param } // call provider - object result = ProviderMethodInfo.Invoke(provider, providerCallParameters); + object result = null; + try + { + result = ProviderMethodInfo.Invoke(provider, providerCallParameters); + } + catch (TargetInvocationException e) + { + if (e.InnerException != null) + throw e.InnerException; + throw; + } // write back out params for (int i = 0; i < PatternMethodParamDescriptions.Count; i++)