dotnet / dotnet/dotnet-api-docs
ParameterInfo.DefaultValue may return Type.Missing
Open
area-System.Reflection
help wanted
Pri3
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
[`ParameterInfo.DefaultValue`](https://learn.microsoft.com/en-us/dotnet/api/system.reflection.parameterinfo.defaultvalue?view=net-7.0) may return `Type.Missing` if parameter is optional, but no default value in metadata (probably COM interop case). Same for [`ParameterInfo.RawDefaultValue`](https://learn.microsoft.com/en-us/dotnet/api/system.reflection.parameterinfo.rawdefaultvalue?view=net-7.0#system-reflection-parameterinfo-rawdefaultvalue)
See implementation
https://github.com/dotnet/runtime/blob/v7.0.13/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs#L287-L298
Contributor guide
Assessment
This issue has not been assessed yet.