Handle. Dangerous Release Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Manually decrements the reference counter on a SafeHandle instance.
public: void DangerousRelease();
[System.Security.SecurityCritical] public void DangerousRelease ();
public void DangerousRelease ();
[<System.Security.SecurityCritical>] member this.DangerousRelease : unit -> unit
member this.DangerousRelease : unit -> unit
Public Sub DangerousRelease ()
This method is intended for advanced users and must always be used carefully. To avoid leaking handle resources, always call this method inside a constrained execution region (CER), where a thread abort cannot interrupt processing. In the same way that unmatched DangerousAddRef calls can cause resource leaks, unmatched DangerousRelease calls can cause invalid handle states to become visible to other threads. Do not expose DangerousAddRef or DangerousRelease calls to untrusted code.