dotnet / dotnet/dotnet-api-docs
ThreadException notice confusing
- Vorherrschende Sprache
- C#
- Sterne
- 949
- Forks
- 1.7k
- Ø Merge
- 2 T. 19 Std.
- Gemergte PRs (30 T.)
- 52
Beschreibung
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?
Beitragsleitfaden
Rechercherichtung
Beginnen Sie mit der Application.ThreadException API-Seite und prüfen Sie den Warnhinweis sowie das darin enthaltene Codebeispiel. Vergleichen Sie den Hinweis mit den verlinkten Diskussionen auf Stack Overflow und PCReview; abgeschlossen ist die Aufgabe, wenn die Dokumentation genau erklärt, wann Handler entfernt werden müssen und ob der Warnhinweis einer Klarstellung bedarf.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- Ein halber Tag
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100