mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
Corrupt or hand-written metadata can contain a property with no MethodSemantics rows at all. MetadataTypeDefinition.Properties already skips properties with neither a visible getter nor setter, so neither the parameterized-property path nor the ordinary one ever sees them; the accessor-method emission also tolerates a missing accessor by construction. Pin that with an ILPretty case containing both a parameterized and an ordinary accessor-less property. Assisted-by: Claude:claude-fable-5:Claude Codepull/3925/head
4 changed files with 51 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||||||
|
public class BrokenProperties |
||||||
|
{ |
||||||
|
private int _field; |
||||||
|
|
||||||
|
public int Touch(int i) |
||||||
|
{ |
||||||
|
return _field + i; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
// Property rows without any MethodSemantics accessors (corrupt or hand-written |
||||||
|
// metadata). The type system skips such properties, whether parameterized or not; |
||||||
|
// decompilation must not crash on them. |
||||||
|
.class public auto ansi beforefieldinit BrokenProperties extends [mscorlib]System.Object |
||||||
|
{ |
||||||
|
.field private int32 _field |
||||||
|
|
||||||
|
.property instance int32 Parameterized(int32) |
||||||
|
{ |
||||||
|
} // end of property BrokenProperties::Parameterized |
||||||
|
|
||||||
|
.property instance int32 Plain() |
||||||
|
{ |
||||||
|
} // end of property BrokenProperties::Plain |
||||||
|
|
||||||
|
.method public hidebysig instance int32 Touch (int32 i) cil managed |
||||||
|
{ |
||||||
|
.maxstack 8 |
||||||
|
ldarg.0 |
||||||
|
ldfld int32 BrokenProperties::_field |
||||||
|
ldarg.1 |
||||||
|
add |
||||||
|
ret |
||||||
|
} // end of method BrokenProperties::Touch |
||||||
|
|
||||||
|
.method public hidebysig specialname rtspecialname instance void .ctor () cil managed |
||||||
|
{ |
||||||
|
.maxstack 8 |
||||||
|
ldarg.0 |
||||||
|
call instance void [mscorlib]System.Object::.ctor() |
||||||
|
ret |
||||||
|
} // end of method BrokenProperties::.ctor |
||||||
|
} |
||||||
Loading…
Reference in new issue