dotnet / dotnet/dotnet-api-docs
Application.ThreadException Event example doesn't follow AppDomain.UnhandledException text
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 950
- Fork
- 1.7k
- Merge medio
- 2g 19h
- PR unite (30g)
- 52
Descrizione
Hi,
On page
system.appdomain.unhandledexception
It states that
This behavior can be changed by using the application configuration file, or by using the Application.SetUnhandledExceptionMode method to change the mode to UnhandledExceptionMode.ThrowException before the ThreadException event handler is hooked up.
The relevant part - "SetUnhandledExceptionMode before the ThreadException event handler is hooked up"
However on page
system.windows.forms.application.threadexception
The example shows SetUnhandledExceptionMode after the ThreadException is hooked up.
public static void Main(string[] args)
{
// Add the event handler for handling UI thread exceptions to the event.
Application.ThreadException += new ThreadExceptionEventHandler(ErrorHandlerForm.Form1_UIThreadException);
// Set the unhandled exception mode to force all Windows Forms errors to go through
// our handler.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
// Add the event handler for handling non-UI thread exceptions to the event.
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
// Runs the application.
Application.Run(new ErrorHandlerForm());
}
thanks
Mike
Guida per i contributori
Apri 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.
Direzione di ricerca
Confronta gli esempi nelle pagine della documentazione di System.AppDomain.UnhandledException e System.Windows.Forms.Application.ThreadException, concentrandoti sull'ordine di SetUnhandledExceptionMode e del gestore ThreadException. Aggiorna l'esempio ThreadException in modo che il suo ordine corrisponda al comportamento descritto, quindi verifica che l'esempio renderizzato e il testo circostante siano coerenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100