Skip to content

[NativeAOT] Finalizers should not run for objects with unsuccessful class init (.cctor) #119038

@VSadov

Description

@VSadov

Re: #118660 (comment)

This applies to the "precise init" case - not the beforeFieldInit.

The behavior of CoreCLR is that Finalizer does not run if class was not initialized successfully.

Note that we do not need to try initialize the class before running finalizer. That should have been attempted already, since we see an instance.

Also note - whether an instance ctor has run is irrelevant.
In fact, finalizer may start and even finish while the ctor is still running.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions