diff --git a/src/ObjCRuntime/Runtime.CoreCLR.cs b/src/ObjCRuntime/Runtime.CoreCLR.cs index 3beaa11122e1..54fa69b6a57b 100644 --- a/src/ObjCRuntime/Runtime.CoreCLR.cs +++ b/src/ObjCRuntime/Runtime.CoreCLR.cs @@ -694,6 +694,8 @@ static object InvokeMethod (MethodBase method, object instance, IntPtr native_pa var ex = tie.InnerException ?? tie; // This will re-throw the original exception and preserve the stacktrace. ExceptionDispatchInfo.Capture (ex).Throw (); + } catch (Exception e) { + throw ErrorHelper.CreateError (8042, e, Errors.MX8042 /* An exception occurred while trying to invoke the function {0}: {1}. */, GetMethodFullName (method), e.Message); } // Copy any byref parameters back out again diff --git a/tools/mtouch/Errors.designer.cs b/tools/mtouch/Errors.designer.cs index 4a3b4830c713..9981c4001bb3 100644 --- a/tools/mtouch/Errors.designer.cs +++ b/tools/mtouch/Errors.designer.cs @@ -4104,5 +4104,14 @@ public static string MX8041 { return ResourceManager.GetString("MX8041", resourceCulture); } } + + /// + /// Looks up a localized string similar to An exception occurred while trying to invoke the function {0}: {1}.. + /// + public static string MX8042 { + get { + return ResourceManager.GetString("MX8042", resourceCulture); + } + } } } diff --git a/tools/mtouch/Errors.resx b/tools/mtouch/Errors.resx index 1925d70a3e47..2c1cadaed8ef 100644 --- a/tools/mtouch/Errors.resx +++ b/tools/mtouch/Errors.resx @@ -2164,4 +2164,11 @@ Unable to create an instance of the type {0}. + + An exception occurred while trying to invoke the function {0}: {1}. + + 0: name of function + 1: exception info + +