CustomAttributes disagrees with GetCustomAttributes on array types
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
```
Console.WriteLine("** CustomAttributes");
foreach (var a in typeof(object[]).CustomAttributes)
Console.WriteLine(a.AttributeType);
Console.WriteLine("** End");
Console.WriteLine("** GetCustomAttributes");
foreach (var a in typeof(object[]).GetCustomAttributes())
Console.WriteLine(a.GetType());
Console.WriteLine("** End");
```
This will print:
```
** CustomAttributes
System.SerializableAttribute
** End
** GetCustomAttributes
** End
```
This is trivial to fix but this code is in the process of getting unified with native AOT so do not assign to copilot this year (pull requests are in flight right now and there might be more and this will be a very unnecessary merge conflict).
Contributor guide
Research direction
Start by reproducing the supplied array-type example and tracing the implementations behind CustomAttributes and GetCustomAttributes for object[]. Compare their handling of SerializableAttribute, then verify that both APIs report consistent results with a regression test. Coordinate with the native AOT work before making changes, since related pull requests are already in flight.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100