Fix crossgen2 issue with generic delegates (#613)
authorJan Vorlicek <janvorli@microsoft.com>
Mon, 9 Dec 2019 10:43:19 +0000 (11:43 +0100)
committerGitHub <noreply@github.com>
Mon, 9 Dec 2019 10:43:19 +0000 (11:43 +0100)
The coreclr pri1 test is failing with the following error:
Expected typeof generic method Type Parameter for parameter, 'aaaa', to
be 'System.String', but found 'System.__Canon'

The issue was caused by the fact that we were not setting the
isInstantiatingStub for calls to generic delegates. The old crossgen
was doing that correctly.

src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DelegateCtorSignature.cs
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunSymbolNodeFactory.cs

index bd13099..338c7bb 100644 (file)
@@ -49,7 +49,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun
                     enforceOwningType: false,
                     innerContext,
                     isUnboxingStub: false,
-                    isInstantiatingStub: false);
+                    isInstantiatingStub: _targetMethod.Method.HasInstantiation);
 
                 builder.EmitTypeSignature(_delegateType, innerContext);
             }
index c6a56f4..f449d69 100644 (file)
@@ -102,7 +102,7 @@ namespace ILCompiler.DependencyAnalysis
                 IMethodNode targetMethodNode = _codegenNodeFactory.MethodEntrypoint(
                     ctorKey.Method,
                     isUnboxingStub: false,
-                    isInstantiatingStub: false,
+                    isInstantiatingStub: ctorKey.Method.Method.HasInstantiation,
                     isPrecodeImportRequired: false,
                     signatureContext: signatureContext);