From: Michal Strehovský Date: Fri, 24 Jan 2020 20:56:32 +0000 (+0100) Subject: Fix validation of uninstantiated generic methods (#2137) X-Git-Tag: submit/tizen/20210909.063632~10240 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7866101d856043808eec5005dfa07ca044a6401;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix validation of uninstantiated generic methods (#2137) Matches what we do for uninstatiated generic types - no need to look at generic parameters. --- diff --git a/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.Validation.cs b/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.Validation.cs index a84ad55..6b9e863 100644 --- a/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.Validation.cs +++ b/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.Validation.cs @@ -25,7 +25,9 @@ namespace ILCompiler { EnsureLoadableType(method.OwningType); - if (method.HasInstantiation) + // If this is an instantiated generic method, check the instantiation. + MethodDesc methodDef = method.GetMethodDefinition(); + if (methodDef != method) { foreach (var instType in method.Instantiation) EnsureLoadableType(instType); @@ -102,12 +104,6 @@ namespace ILCompiler { ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, type); } -#if READYTORUN - else if (type.IsGenericParameter) - { - return type; - } -#endif else { // Validate classes, structs, enums, interfaces, and delegates