Reduce ifdefs in the shared RuntimeCustomAttributeData.cs - #134117
Merged
MichalStrehovsky merged 5 commits intoSep 25, 2026
Merged
MichalStrehovsky merged 5 commits into
MichalStrehovsky merged 5 commits into
Conversation
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: 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. |
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection |
Contributor
There was a problem hiding this comment.
🟡 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
Contributor
There was a problem hiding this comment.
🔵 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.CoreLibproject, while Mono does not compile either of the newRuntimeCustomAttributeData.CoreCLR.csor.NativeAot.csfiles and no MonoQCustomAttributeListdefinition exists. The new call at this line therefore leavesQCustomAttributeListundefined for Mono builds (the existing Mono-specific implementation was not covered by the old#if NATIVEAOTbranches). 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
jkotas
reviewed
Sep 21, 2026
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
jkotas
approved these changes
Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).