This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reflection: Fix DefaultValue exception with enums (#17917)
This is related to dbcfd2f, but about enums instead of `DateTime`. Given e.g. a generic method with a parameter `T arg = default(T)` where `T` is the generic type parameter, if that is instantiated with some enum as the generic type argument, then querying the default value of `arg` using `ParameterInfo.[Raw]DefaultValue` will throw a `FormatException`. (The use of generics means that the C# compiler always records a `null` constant in metadata, which isn't usually the case for enums.)
- Loading branch information