Implement a Dispose method has contradictory example to documentation about thread synchronization
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 57/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- csharp
- Ambito
- documentation
Direzione di ricerca
Read docs/standard/garbage-collection/implementing-dispose.md, especially the custom safe handle section and its note about SafeHandle.ReleaseHandle. Compare that note with the example's Interlocked.CompareExchange use, then verify the accurate explanation with the relevant .NET disposal guidance. Update the example or note so they agree and the synchronization behavior is clear.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Type of issue
Missing information
Description
On the page Implement a Dispose method, the section Implement the dispose pattern using a custom safe handle has a NOTE section that says:
[!NOTE]
- ....
- There is no need for synchronization to guarantee thread safety. Even though there is a race condition in the Dispose implementation of DisposableBaseWithSafeHandle, SafeHandle guarantees that SafeHandle.ReleaseHandle is called only once.
However, the example under that specific section, "Implement the dispose pattern using a custom safe handle", still includes thread synchronization using Interlocked.CompareExchange. This is contradictory and confusing. Should the thread synchronization be remove that that specific example - or is the statement about not needing thread synchronization incorrect?
Page URL
Content source URL
https://github.com/dotnet/docs/blob/main/docs/standard/garbage-collection/implementing-dispose.md
Document Version Independent Id
9c754da1-c234-fb12-580b-0fcf9ffe2c20
Platform Id
de77d8c7-6af8-0b64-9357-30e46ab49cbd
Article author
@gewarren
Metadata
- ID: 572ef6c6-5066-4a14-76a0-c3fb4b62e604
- PlatformId: de77d8c7-6af8-0b64-9357-30e46ab49cbd
- Service: dotnet-fundamentals
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 4.8k
- Fork
- 6.1k
- Merge medio
- 1g 2h
- PR unite (30g)
- 255
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dotnet/docs
-
Improve description of `limitations of extensions`Forse già presa @Manish-1kumar l’ha presa 3 giorni fa. Apertaadvanced-concepts/subsvc dotnet-csharp/svc
Difficoltà 1/5 1-3 ore Idoneità per principianti 84/100
dotnet/docs#56626 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
dgApertadotnet-fundamentals/svc needs-more-info
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
dotnet/docs#56549 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Document unit-test / theory-data impact of .NET 11 double→decimal conversionForse già presa @SkyDevLab l’ha presa 14 giorni fa. Aperta:watch: Not Triaged dotnet-fundamentals/svc
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
dotnet-fundamentals/svc install/subsvc
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dotnet/docs#56344 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Upgrade from `net9.0` to LTS (or STS) image tagForse già presa @ShyneChikwapulo l’ha presa 22 giorni fa. Apertadotnet-target-version
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
dotnet/docs#56293 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
aws-samples/sample-per-model-bedrock#752 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
fairagro/m4.2_infrastructure#68 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
area:docs priority:p2 type:docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jejjohnson/geostack#120 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Hochfrequenz/AIBAP_TEMPLATE_REPOSITORY#22 · 2 commenti ·
-
lesson-submission pending-review
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
Ikalus1988/MisakaNet#4452 ·
I maintainer di solito rispondono entro 1 giorno