Skip to content

Compiler generates invalid IL code for set method bodies #10

@LinuxDoku

Description

@LinuxDoku
.method public hidebysig specialname static 
          string  get_HelloWorldProperty() cil managed
  {
    .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) 
    // Code size       11 (0xb)
    .maxstack  8
    IL_0000:  nop
    IL_0001:  ldstr      "This is a Test"
    //IL_0006:  stloc.0
    //IL_0007:  br.s       IL_0009

    //IL_0009:  ldloc.0
    IL_000a:  ret
  } // end of method Program::get_HelloWorldProperty

The uncommented lines (IL_0006, IL_0007, IL_0009) are generated, but are invalid at this place. So the patched application crashes with a CLR Exception System.InvalidProgramException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions