IsValueType not set correctly for custom attribute fields of an enum type #941
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
All parts of the TypeReference for such an enum are right, it's just not flagged as a value type. As a result, using that TypeReference elsewhere results in load/resolve-time errors when using the modified assembly.
Looks like the reading for custom attribute fields/properties (
AssemblyReader.ReadCustomAttributeFieldOrPropType) sees ElementType.Enum and then bases the TypeReference on the type name it finds.Hmm, this reminds me of something:
github.com/ltrzesniewski/InlineIL.Fody@b257467995/src/InlineIL.Fody/Model/TypeRefBuilder.cs (L174-L181)I wrote the following comment:
IIRC this applies to all value types, not only enums, since the
TypeRefmetadata table does not store this flag.Yes, for the general case where there is just an utf8 type name to be resolved in the typeref table, that's understandable.
But here the ElementType adds that extra bit of information, because (afaik) all enums are value types.