Description
Not fixing this for .NET 6 as we decided it's too risky to change runtime layouts now, it would also require bumping up the readytorun major version, but it's a bug nonetheless. For an explicit layout class with a base class, we place its fields as if the base class was twice its actual instance size. This is because we first take the base class instance size into account when calculating the layout itself in
runtime/src/coreclr/vm/classlayoutinfo.cpp
Line 138 in ffb095a
and we add the parent class size a second time in MethodTableBuilder::HandleExplicitLayout in
runtime/src/coreclr/vm/methodtablebuilder.cpp
Line 8579 in ffb095a
and
runtime/src/coreclr/vm/methodtablebuilder.cpp
Line 8631 in ffb095a
/cc @dotnet/crossgen-contrib, @dotnet/dotnet-coreclr