Skip to content

Ensure we keep metadata for fields#113759

Merged
MichalStrehovsky merged 1 commit intodotnet:mainfrom
MichalStrehovsky:fldmeta
Mar 22, 2025
Merged

Ensure we keep metadata for fields#113759
MichalStrehovsky merged 1 commit intodotnet:mainfrom
MichalStrehovsky:fldmeta

Conversation

@MichalStrehovsky
Copy link
Member

We already do this for methods but FieldMetadataNode was missing the matching logic (we'd only keep metadata for custom modifiers in the lines above those I'm touching).

We already do this for methods but `FieldMetadataNode` was missing the matching logic (we'd only keep metadata for custom modifiers in the lines above those I'm touching).
Copilot AI review requested due to automatic review settings March 21, 2025 13:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds logic to preserve metadata for fields by updating dependency analysis and provides a corresponding test to validate the behavior.

  • Added a test in Reflection.cs to verify field and parameter metadata is preserved.
  • Updated FieldMetadataNode.cs to include metadata for the field type.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/tests/nativeaot/SmokeTests/Reflection/Reflection.cs Added TestFieldAndParamMetadata to verify field and parameter type metadata preservation.
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FieldMetadataNode.cs Updated dependency analysis to include the field's type metadata.

Comment on lines +838 to +839
public class FieldType;

Copy link

Copilot AI Mar 21, 2025

Choose a reason for hiding this comment

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

The declaration 'public class FieldType;' appears to be incomplete; in C# class declarations require a body (e.g., use '{ }' instead of a semicolon).

Suggested change
public class FieldType;
public class FieldType { }

Copilot uses AI. Check for mistakes.
Comment on lines +842 to +843
public class ParameterType;

Copy link

Copilot AI Mar 21, 2025

Choose a reason for hiding this comment

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

The declaration 'public class ParameterType;' is incomplete and should include a body (e.g., '{ }') to be valid C# syntax.

Suggested change
public class ParameterType;
public class ParameterType { }

Copilot uses AI. Check for mistakes.
@MichalStrehovsky MichalStrehovsky merged commit 1f76c1f into dotnet:main Mar 22, 2025
98 of 100 checks passed
@MichalStrehovsky MichalStrehovsky deleted the fldmeta branch March 22, 2025 07:58
@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants