Imported Upstream version 5.14.0.78

Former-commit-id: 3494343bcc9ddb42b36b82dd9ae7b69e85e0229f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-05-10 08:37:03 +00:00
parent 74b74abd9f
commit 19234507ba
1776 changed files with 67755 additions and 31107 deletions

View File

@ -277,6 +277,8 @@ namespace System.Reflection {
/*
* InternalInvoke() receives the parameters correctly converted by the
* binder to match the types of the method signature.
* The exc argument is used to capture exceptions thrown by the icall.
* Exceptions thrown by the called method propagate normally.
*/
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern Object InternalInvoke (Object obj, Object[] parameters, out Exception exc);
@ -298,19 +300,22 @@ namespace System.Reflection {
Exception exc;
object o = null;
try {
// The ex argument is used to distinguish exceptions thrown by the icall
// from the exceptions thrown by the called method (which need to be
// wrapped in TargetInvocationException).
o = InternalInvoke (obj, parameters, out exc);
} catch (ThreadAbortException) {
throw;
if ((invokeAttr & BindingFlags.DoNotWrapExceptions) == 0) {
try {
o = InternalInvoke (obj, parameters, out exc);
} catch (ThreadAbortException) {
throw;
#if MOBILE
} catch (MethodAccessException) {
throw;
} catch (MethodAccessException) {
throw;
#endif
} catch (Exception e) {
throw new TargetInvocationException (e);
} catch (Exception e) {
throw new TargetInvocationException (e);
}
}
else
{
o = InternalInvoke (obj, parameters, out exc);
}
if (exc != null)
@ -649,22 +654,26 @@ namespace System.Reflection {
throw new MemberAccessException (String.Format ("Cannot create an instance of {0} because it is an abstract class", DeclaringType));
}
return InternalInvoke (obj, parameters);
return InternalInvoke (obj, parameters, (invokeAttr & BindingFlags.DoNotWrapExceptions) == 0);
}
public object InternalInvoke (object obj, object[] parameters)
public object InternalInvoke (object obj, object[] parameters, bool wrapExceptions)
{
Exception exc;
object o = null;
try {
o = InternalInvoke (obj, parameters, out exc);
if (wrapExceptions) {
try {
o = InternalInvoke (obj, parameters, out exc);
#if MOBILE
} catch (MethodAccessException) {
throw;
} catch (MethodAccessException) {
throw;
#endif
} catch (Exception e) {
throw new TargetInvocationException (e);
} catch (Exception e) {
throw new TargetInvocationException (e);
}
} else {
o = InternalInvoke (obj, parameters, out exc);
}
if (exc != null)