Fix custom attribute with enum on generic type #827
Loading…
Reference in a new issue
No description provided.
Delete branch "EnumOnGenericAsAttributeValue"
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?
Fixes both the reader and the write to correctly handle values of type enum on a generic type.
Cecil represents generic instantiations as typeref which has etype GenericInst, so the exising check for etype doesn't work. Also since attributes only allow simple values and enums (and types), there's technically no other way to get a GenericInst then the enum case.
Added several test for various combinations of boxed an unboxed enums on generic type.
Added a test case provided by @mrvoorhe with array of such enums.
Fixes #804
Had to disable the new tests when targeting .NET Framework. The tests are using CodeDOM compiler in that case and it doesn't support parsing enums on generic type as attribute arguments. I don't think the tests are important enough to try to rework how the tests are working on .NET Framework and make them use Roslyn there as well.
Beautiful, thank you!