Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Kanamori <AtsushiKan@users.noreply.github.com>2017-07-10 23:11:05 +0300
committerGitHub <noreply@github.com>2017-07-10 23:11:05 +0300
commit7b6ea7f3e303990f88b09650162931dd239e3af5 (patch)
tree64e5825f11f1a169edc005dc0e8ef399aaa31e3b /src/System.Private.Reflection.Execution
parent40aba3c4f6316fffebfada5bcf2940453eca5e0e (diff)
Fix TFS 134375 Delegate.GetMethodInfo should throw if no metadata (#4130)
Diffstat (limited to 'src/System.Private.Reflection.Execution')
-rw-r--r--src/System.Private.Reflection.Execution/src/Internal/Reflection/Extensions/NonPortable/DelegateMethodInfoRetriever.cs4
-rw-r--r--src/System.Private.Reflection.Execution/src/Resources/Strings.resx6
2 files changed, 8 insertions, 2 deletions
diff --git a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Extensions/NonPortable/DelegateMethodInfoRetriever.cs b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Extensions/NonPortable/DelegateMethodInfoRetriever.cs
index eccf479f6..7bc241759 100644
--- a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Extensions/NonPortable/DelegateMethodInfoRetriever.cs
+++ b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Extensions/NonPortable/DelegateMethodInfoRetriever.cs
@@ -61,7 +61,7 @@ namespace Internal.Reflection.Extensions.NonPortable
RuntimeTypeHandle declaringTypeHandleIgnored;
MethodNameAndSignature nameAndSignatureIgnored;
if (!TypeLoaderEnvironment.Instance.TryGetRuntimeMethodHandleComponents(resolver->GVMMethodHandle, out declaringTypeHandleIgnored, out nameAndSignatureIgnored, out genericMethodTypeArgumentHandles))
- return null;
+ throw new MissingRuntimeArtifactException(SR.DelegateGetMethodInfo_NoInstantiation);
}
}
}
@@ -69,7 +69,7 @@ namespace Internal.Reflection.Extensions.NonPortable
if (callTryGetMethod)
{
if (!ReflectionExecution.ExecutionEnvironment.TryGetMethodForOriginalLdFtnResult(originalLdFtnResult, ref typeOfFirstParameterIfInstanceDelegate, out methodHandle, out genericMethodTypeArgumentHandles))
- return null;
+ throw new MissingRuntimeArtifactException(SR.DelegateGetMethodInfo_NoDynamic);
}
MethodBase methodBase = ReflectionCoreExecution.ExecutionDomain.GetMethod(typeOfFirstParameterIfInstanceDelegate, methodHandle, genericMethodTypeArgumentHandles);
MethodInfo methodInfo = methodBase as MethodInfo;
diff --git a/src/System.Private.Reflection.Execution/src/Resources/Strings.resx b/src/System.Private.Reflection.Execution/src/Resources/Strings.resx
index 2024d9b80..ab51c940c 100644
--- a/src/System.Private.Reflection.Execution/src/Resources/Strings.resx
+++ b/src/System.Private.Reflection.Execution/src/Resources/Strings.resx
@@ -228,4 +228,10 @@
<data name="Acc_ReadOnly" xml:space="preserve">
<value>Cannot set a constant field.</value>
</data>
+ <data name="DelegateGetMethodInfo_NoDynamic" xml:space="preserve">
+ <value>Cannot retrieve a MethodInfo for this delegate because the method it targeted was not enabled for metadata using the Dynamic attribute. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=616868</value>
+ </data>
+ <data name="DelegateGetMethodInfo_NoInstantiation" xml:space="preserve">
+ <value>Cannot retrieve a MethodInfo for this delegate because the necessary generic instantiation was not metadata-enabled. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=616868</value>
+ </data>
</root>