-
Notifications
You must be signed in to change notification settings - Fork 5k
Added another case in the switch block to handle the object returned by Mono which differs from the object returned by CoreCLR #115885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e the object returned by Mono which differs from CoreCLR.
@Venkad000 Can you also please add a test for this? Someplace under https://github.com/dotnet/runtime/tree/main/src/libraries/System.Runtime/tests/System.Reflection.Tests would make the most sense. /cc @ericstj |
wouldn't it be better to add it here https://github.com/dotnet/runtime/blob/main/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/NullabilityInfoContextTests.cs as this specifically deals with tests regarding NullabilityInfoContext? |
Oh yes, much better. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@AaronRobinsonMSFT Can we merge this? |
/ba-g Unrelated timeout |
Fixes #115295 . Added another case in the switch block to handle the object returned by Mono which differs from the object returned by CoreCLR.
When
Create(FieldInfo fieldInfo)
is called upon an object ofNullabilityInfoContext
, the function creates a new object ofNullabilityAttributeStateParser
by callingCreateParser
with aList<CustomAttributes>
as argument to it. TheNullabilityAttributeStateParser
has a memberprivate readonly object? _nullableAttributeArgument
which is set toattribute.ConstructorArguments[0].Value
in theCreateParser
function. CoreCLR returnsattribute.ConstructorArguments[0].Value
as an object of typeReadOnlyCollection<CustomAttributeTypedArgument>
whereas Mono returns it asbyte[]
. Therefore, the type which is reflected in the switch block is never matched against and hence gets the wrong NullabilityState set to it.