Note: I am starting a new topic becuase it seems one cannot post to
old topics.
Further to
http://groups.google.com/group/mono-cecil/browse_thread/thread/6cc89d5004ec24a1The patch suggested by Dave does not work for enum constants. Instead,
I am using the following lines at the start of the
ReflectionWriter.WriteConstant method:
// Remove reference/pointer adornment
if (type is TypeSpecification)
type = ((TypeSpecification)type).ElementType;
// convert TypeReference to TypeDefinition so that it can
work with enum constants
if(!(type is TypeDefinition))
type = type.Resolve();
I don't think this will cause any side-effects since constants can
only have a limited values. However, Jb is requested to review this
PATCH and integrate it within Cecil.
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---