Skip to content

Instantly share code, notes, and snippets.

@lambdageek
Created February 12, 2019 22:07
Show Gist options
  • Save lambdageek/982e57262a8dffe3e19fda6141a67e11 to your computer and use it in GitHub Desktop.
Save lambdageek/982e57262a8dffe3e19fda6141a67e11 to your computer and use it in GitHub Desktop.
standalone repro 10564
all: Repro10564.exe
.PHONY: all clean
Repro10564.exe: Repro10564.cs Mods.dll
csc /out:$@ /target:exe $< -r:./Mods.dll
Mods.dll: Mods.il
ilasm /output:$@ /dll $<
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly Mods
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module Mods.dll
.class public auto ansi beforefieldinit CL1`1<T1>
extends[mscorlib] System.Object
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call instance void[mscorlib] System.Object::.ctor()
IL_0006: ret
} // end of method CL1`1::.ctor
.property instance !T1 modopt([mscorlib]System.Runtime.CompilerServices.IsConst)
Test()
{
.get instance !T1 modopt([mscorlib]System.Runtime.CompilerServices.IsConst) CL1`1::get_Test()
.set instance void CL1`1::set_Test(!T1 modopt([mscorlib]System.Runtime.CompilerServices.IsConst))
} // end of property CL1`1::Test
.method public hidebysig newslot specialname virtual
instance !T1 modopt([mscorlib]System.Runtime.CompilerServices.IsConst)
get_Test() cil managed
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: throw
} // end of method CL1`1::get_Test
.method public hidebysig newslot specialname virtual
instance void set_Test(!T1 modopt([mscorlib]System.Runtime.CompilerServices.IsConst) x) cil managed
{
// Code size 3 (0x3)
.maxstack 1
IL_0000: ldarg.0
IL_0001: throw
IL_0002: ret
} // end of method CL1`1::set_Test
} // end of class CL1`1
.class public auto ansi beforefieldinit CL2
extends class CL1`1<int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong)>
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call instance void class CL1`1<int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong)>::.ctor()
IL_0006: ret
} // end of method CL2::.ctor
} // end of class CL2
class Module1
{
static void Main()
{
CL2 x = new CL3();
x.Test = 0;
var y = x.Test;
// expected output:
//
// Set Overridden
// Get Overridden
}
}
class CL3
: CL2
{
public override int Test
{
get
{
System.Console.WriteLine("Get Overridden");
return 0;
}
set
{
System.Console.WriteLine("Set Overridden");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment