Skip to content

MethodTable::IsClassInited returns false for <PrivateImplementationDetails> class #104247

@EgorBo

Description

@EgorBo

See #104054 for discussion.

public class Program
{
    static void Main()
    {
        Test();
    }

    static ReadOnlySpan<int> RvaData => [1, 2, 3, 4];

    [MethodImpl(MethodImplOptions.NoInlining)]
    static int Test() => RvaData[2];
}

This code (TieredCompilation=0) used to fold RvaData[2] into 3, it's no longer happening because getStaticFieldContent gives up on <PrivateImplementationDetails> being non-initialized statically (despite the fact it has no cctor)

Previously, it used to return true and everything was correctly folded, it's no longer the case after #99183

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions