Consider the following type definitions:
public abstract class Base1
{
private object _object;
private byte _byte;
}
public abstract class Base2
{
private WrappedObject _object;
private byte _byte;
private struct WrappedObject
{
private object _object;
}
}
public sealed class Derived1 : Base1
{
private byte _byte;
}
public sealed class Derived2 : Base2
{
private byte _byte;
}
Derived1 will group the two byte fields together with 6 bytes of padding.
Derived2 will store the two byte fields separately and add 7 bytes of padding after each one.
As a result, Derived1 takes up 16 bytes (after the header and MT), but Derived2 takes up 24.


Is such a layout intentional, or just a random inefficiency?
Hit in #62981