Skip to content
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

CustomAttribute with Array Properties sets nulls incorrectly #31195

Closed
JamesAshworth opened this issue Oct 17, 2019 · 7 comments · Fixed by #44813
Closed

CustomAttribute with Array Properties sets nulls incorrectly #31195

JamesAshworth opened this issue Oct 17, 2019 · 7 comments · Fixed by #44813

Comments

@JamesAshworth
Copy link

An attribute with two array properties does not behave as expected if the first array property is set to a value and the second array property is set to null. If the two arrays are of the same type, the second property is set to the same value as the first property. If the two types are incompatible, an exception is thrown when the attribute is constructed, stating that the second property cannot be found.

Attached are two variations on a simple program that replicates each issue.

Same Type
Incompatible Types

@0xd4d
Copy link

0xd4d commented Oct 17, 2019

The signature of _GetPropertyOrFieldData should be updated from out object value to ref object value since it doesn't always initialize it. Or the native method should be updated to always initialize it.

https://github.com/dotnet/coreclr/blob/master/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs#L1493

value isn't initialized if arraySize == -1.

https://github.com/dotnet/coreclr/blob/master/src/vm/customattribute.cpp#L1004-L1015

@danmoseley
Copy link
Member

Thanks for the report and diagnosis. Are either of you interested in offering a PR?

@0xd4d
Copy link

0xd4d commented Oct 18, 2019

@danmosemsft No, but maybe someone else wants to do it.

@danmoseley
Copy link
Member

@JamesAshworth ? 😃

@JamesAshworth
Copy link
Author

@danmosemsft Not an area I'm confident enough with I'm afraid - not looked at this code before, and haven't got the time at the moment to get familiar.

@danmoseley
Copy link
Member

Thanks @JamesAshworth not a problem.

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 5.0 milestone Feb 1, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@steveharter steveharter added bug and removed untriaged New issue has not been triaged by the area owner labels Mar 4, 2020
@steveharter
Copy link
Member

Moving to future based on priority + schedule.

@steveharter steveharter modified the milestones: 5.0.0, Future Aug 11, 2020
@steveharter steveharter modified the milestones: Future, 6.0.0 Nov 13, 2020
@steveharter steveharter self-assigned this Nov 16, 2020
@steveharter steveharter removed the help wanted [up-for-grabs] Good issue for external contributors label Nov 16, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants