dotnet / dotnet/dotnet-api-docs
ThreadException notice confusing
- Lingua principale
- C#
- Stelle
- 949
- Fork
- 1.7k
- Merge medio
- 2g 19h
- PR unite (30g)
- 52
Descrizione
https://docs.microsoft.com/en-gb/dotnet/api/system.windows.forms.application.threadexception?view=netframework-4.7
On the `Application.ThreadException` page - there is the below notice:
> Caution
> Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
That confused me - surely the event will be disposed when the application ends anyway? Or is this suggesting that some resources may be kept hold of, once my application has already terminated?
I looked at the code example on that page, which seems to do no special handling regarding this notice. I then Googled it - and seems I wasn't the only person confused:
https://stackoverflow.com/q/7812627/1768779
https://www.pcreview.co.uk/threads/detach-application-threadexception-event-really.3084009/
Is the explanation on StackOverflow correct? If so - that seems a niche case to pull out in a big red **Caution** box - could the situation be clarified?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia dalla pagina dell'API Application.ThreadException ed esamina l'avviso di cautela e il relativo esempio di codice. Confronta l'avviso con le discussioni collegate di Stack Overflow e PCReview; il lavoro è completato quando la documentazione spiega accuratamente quando è necessario scollegare gli handler e se l'avviso richiede chiarimenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100