Skip to content

Reduce ifdefs in the shared RuntimeCustomAttributeData.cs - #134117

Merged
MichalStrehovsky merged 5 commits into
dotnet:mainfrom
MichalStrehovsky:refactor/qcustomattribute-list
Sep 25, 2026
Merged

MichalStrehovsky merged 5 commits into
dotnet:mainfrom
MichalStrehovsky:refactor/qcustomattribute-list

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

The first commit is pretty straightforward.
The second commit introduces a bit of ugliness on the native AOT side but probably still worth it (but I don't feel too strongly).

MichalStrehovsky and others added 2 commits September 15, 2026 16:31
Introduce runtime-specific QCustomAttributeList wrappers and remove repeated NATIVEAOT conditionals from shared custom attribute callers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the CoreCLR parsing flow shared, move NativeAOT argument enumeration into the parser, and isolate named argument target decoding by runtime.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The shared file references an undefined QCustomAttributeList for Mono builds.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Refactors custom-attribute handling around a shared QCustomAttributeList abstraction for CoreCLR and NativeAOT.

Changes:

  • Centralizes custom-attribute retrieval and parsing.
  • Adds CoreCLR and NativeAOT implementations.
  • Reduces duplicated conditional compilation.
File summaries
File Summary
src/libraries/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs Uses the shared abstraction and parsing helpers; requires a Mono-compatible definition.
src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.CoreCLR.cs Adds the CoreCLR attribute-list implementation.
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.NativeAot.cs Adds the NativeAOT attribute-list implementation and parser support.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 17, 2026 03:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The shared code references QCustomAttributeList, which is undefined in Mono builds.

Review details

Suppressed comments (1)

src/libraries/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs:37

  • This shared file is still compiled by the Mono System.Private.CoreLib project, while Mono does not compile either of the new RuntimeCustomAttributeData.CoreCLR.cs or .NativeAot.cs files and no Mono QCustomAttributeList definition exists. The new call at this line therefore leaves QCustomAttributeList undefined for Mono builds (the existing Mono-specific implementation was not covered by the old #if NATIVEAOT branches). Please add a Mono-compatible definition/source or keep this abstraction in a source included by Mono.
            IList<CustomAttributeData> cad = GetCustomAttributes(new QCustomAttributeList(target));
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

MichalStrehovsky and others added 2 commits September 25, 2026 13:05
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ab64e674-0ade-44b7-a8da-9a03733251ed
Copilot AI review requested due to automatic review settings September 25, 2026 04:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Review effort: Lite
Findings: None

@MichalStrehovsky
MichalStrehovsky enabled auto-merge (squash) September 25, 2026 05:41
@MichalStrehovsky
MichalStrehovsky merged commit 577b0fc into dotnet:main Sep 25, 2026
145 of 147 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the refactor/qcustomattribute-list branch September 25, 2026 06:51
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants