Skip to content

Implement CriticalFinalizerObject #881

Closed
@amaitland

Description

@amaitland

So I'm thinking some of our classes may need to implement CriticalFinalizerObject to grantee that their resources are disposed of correctly.

https://msdn.microsoft.com/en-us/library/system.runtime.constrainedexecution.criticalfinalizerobject%28v=vs.110%29.aspx

Implementing IDisposable on a CriticalFinalizerObject-derived type is tricky because void Dispose(bool disposing) is virtual, yet it must run within a Constrained Execution Region. This may require an explicit call to RuntimeHelpers.PrepareMethod.

http://www.codeproject.com/Articles/29534/IDisposable-What-Your-Mother-Never-Told-You-About

Anyone have past experience implementing CriticalFinalizerObject? Is it worth doing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions