I've noticed that some assemblies I've round-tripped with Cecil have
lost custom modifiers.
It appears that Cecil is ignoring the custom modifiers for PointerType
and ArrayType, (PTR, SZARRAY) giving the CustomModifier collections
that are empty. These seem to be correctly read in SignatureReader.cs,
but lost at some point.
Also, on Param and RetType BYREF custom modifiers seem to be read
incorrectly/lost, (creating a ParameterType == null) - this appears to
be a deeper error in SignatureReader.cs
Here's some sample IL code that re-creates this problem:
///////////////////////////////////////////////////
// Test.il
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.hash = (D6 3C D5 F2 93 05 7D B8 70 CA 1F 2A 67 A8 41 9F
0B 57 87 84 )
.ver 2:0:0:0
}
.assembly Test
{
.permissionset reqmin
=
{[mscorlib]System.Security.Permissions.SecurityPermissionAttribute =
{property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 1:0:0:0
}
.module Test.dll
.class TestClass
{
.method public static void TestPtr(uint32
modopt([mscorlib]System.Runtime.CompilerServices.IsLong)* param1) cil
managed
{
.maxstack 1
IL_0: ret
}
.method public static void TestSzArray(uint32
modopt([mscorlib]System.Runtime.CompilerServices.IsLong)[] param1) cil
managed
{
.maxstack 1
IL_0: ret
}
.method public static void TestRef(uint32
modopt([mscorlib]System.Runtime.CompilerServices.IsLong)& param1) cil
managed
{
.maxstack 1
IL_0: ret
}
}
//////////////////////////////////////////
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---