dotnet / dotnet/dotnet-api-docs

WaitHandle.Dispose – diposing is not necessary

Open
#7,507 4 comments 0 reactions 0 assignees View on GitHub
area-System.Runtime Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

From [WaitHandle.Dispose Method](https://docs.microsoft.com/en-us/dotnet/api/system.threading.waithandle.dispose?view=net-6.0#System_Threading_WaitHandle_Dispose)

> Note
>
> Always call Close or Dispose() before you release your last reference to the WaitHandle. Otherwise, the resources it is using will not be freed.

While fact that `WaitHandle` uses `SafeWaitHandle` that will be finalized when `Dispose` not called is implementation detail, I guess this note better avoid direct lying. I cannot tell for previous version though.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.