The ConstructorBuilder and MethodBuilder generated parameter should not have default value by default#84550
The ConstructorBuilder and MethodBuilder generated parameter should not have default value by default#84550buyaa-n merged 13 commits intodotnet:mainfrom
Conversation
…ot has default value by default
|
Tagging subscribers to this area: @dotnet/area-system-reflection-emit Issue DetailsFixes #20909
|
src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs
Show resolved
Hide resolved
| { | ||
| if (IsRetval) | ||
| { | ||
| return DBNull.Value; |
There was a problem hiding this comment.
Could not think of any case where return parameter could have a default value, double checking with the area experts CC @AaronRobinsonMSFT @jkotas @steveharter
There was a problem hiding this comment.
Tagging mono folks @lambdageek @marek-safar @vargaz
There was a problem hiding this comment.
Why is the extra if needed?
There was a problem hiding this comment.
Because GetDefaultValue returns null instead of DBNull.Value/Type.Missing, which makes HasDefaultValue return true for return parameters. Do we consider a return parameter in mono to have default values for a valuable reason or it is just an error ?
There was a problem hiding this comment.
I think better fix would be to update add_parameter_object_to_array
There was a problem hiding this comment.
I don't think it would fix the probem. The add_parameter_object_to_array processes only input parameters. In fact, The ReturnParameter is constructed here :
Mono does not provide DefaultValueImpl to RuntimeParameterInfo as you can see, we can add a new method in mono like get_retval_marshal that return a hardcoded DbNull.Value or do it directly in the dedicated constructor:
Let me know which one do you prefer
There was a problem hiding this comment.
Setting the default DbNull.Value directly in the dedicated constructor sounds reasonable to me, ping @marek-safar for opinion
buyaa-n
left a comment
There was a problem hiding this comment.
LGTM, thanks @pedrobsaila
|
The failure unrelated and known |
|
Breaking change: dotnet/docs#36725 |
Fixes #20909