[Fact]
public void Test1234567()
{
var ilSource = @"
.class public auto ansi beforefieldinit C1`1<T>
extends System.Object
{
// Methods
.method public hidebysig static
string Method () cil managed
{
// Method begins at RVA 0x2050
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr ""Method""
IL_0005: ret
} // end of method C1`1::Method
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x2057
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void System.Object::.ctor()
IL_0006: ret
} // end of method C1`1::.ctor
} // end of class C1`1
.class public auto ansi beforefieldinit C2`1<T>
extends System.Object
{
// Methods
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x2057
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void System.Object::.ctor()
IL_0006: ret
} // end of method C2`1::.ctor
} // end of class C2`1
.class public auto ansi beforefieldinit C3`1<T>
extends class C1`1<int32 modopt(class C2`1<!T>)>
{
// Methods
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x205f
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void class C1`1<int32>::.ctor()
IL_0006: ret
} // end of method C3`1::.ctor
} // end of class C3`1
";
var source = @"
class Test
{
static void Main()
{
M<int>();
}
static void M<T>()
{
System.Func<string> x = C3<T>.Method;
System.Console.WriteLine(x());
}
}
";
var compilation = CreateCompilationWithIL(source, ilSource, options: TestOptions.ReleaseExe);
CompileAndVerify(compilation, expectedOutput: @"Method");
}
Observed:
Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen.CodeGenNullCheckedParameterTests.Test1234567 [FAIL]
System.MissingMethodException : Method not found: 'System.String C2`1.Method()'.
Stack Trace:
at Test.M[T]()
at Test.Main()
Note that containing type C2`1<!!T>::Method() at IL_0001 is incorrect. It should be C1<System.Int32 modopt(C2<!!T>)>.Method()
.method private hidebysig static void M<T>() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: ldnull
IL_0001: ldftn string class ['_0_e06aa5d9-06de-47fb-898c-85f1b5e9d746']C2`1<!!T>::Method()
IL_0007: newobj instance void class [mscorlib]System.Func`1<string>::.ctor(object,
native int)
IL_000c: callvirt instance !0 class [mscorlib]System.Func`1<string>::Invoke()
IL_0011: call void [mscorlib]System.Console::WriteLine(string)
IL_0016: ret
} // end of method Test::M
Observed:
Note that containing type
C2`1<!!T>::Method()at IL_0001 is incorrect. It should beC1<System.Int32 modopt(C2<!!T>)>.Method()