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

Refactor runtime-specific logic out of CustomAttributeData #55870

Merged
merged 12 commits into from
Jul 17, 2021

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Jul 17, 2021

CustomAttributeData is meant to be abstract base class of reflection object model. Move the runtime-specific part
into a separate RuntimeCustomAttributeData type.

This avoids bugs like #55726 by construction.

CustomAttributeData is meant to be abstract base class of reflection object model. Move the runtime-specific part
into a separate RuntimeCustomAttributeData type.
bool first = true;

int count = ConstructorArguments.Count;
IList<CustomAttributeTypedArgument> constructorArguments = ConstructorArguments;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache in locals to avoid redundant interface calls.

@@ -79,6 +87,11 @@ public override string ToString()

#region Public Members
public virtual Type AttributeType => Constructor.DeclaringType!;

// Expected to be overriden
public virtual ConstructorInfo Constructor => null!;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the existing Mono behavior. The existing CoreCLR behavior is to throw NullReferenceException in some of these.

@jkotas jkotas merged commit 8c48f94 into dotnet:main Jul 17, 2021
@jkotas jkotas deleted the customattributedata branch July 17, 2021 22:32
@ghost ghost locked as resolved and limited conversation to collaborators Aug 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

3 participants