FixedAddressValueType is silently ignored when not supported
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
Given a class like
```cs
static class C
{
[FixedAddressValueType]
public static int I;
[FixedAddressValueType]
public static object O;
}
```
Since CoreCLR ignores `FixedAddressValueType` on non ValueType fields, this will silently allocate the fields normally.
This can cause potential GC holes in code unaware of this.
The runtime should either make `FixedAddressValueType` work in all cases (like POH arrays do) or throw `TypeLoadException` when not supported.
cc @jkotas what do you think?
Contributor guide
Research direction
Start by reproducing the C# example with FixedAddressValueType on both the int and object static fields, then trace the CoreCLR handling for unsupported non-ValueType fields. Resolve whether the runtime should support the attribute for all fields or throw TypeLoadException, and verify the chosen behavior with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100