dotnet / dotnet/dotnet-api-docs

Application.ThreadException Event example doesn't follow AppDomain.UnhandledException text

Aperta
#8,238 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

area-WinForms Pri3 untriaged
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. 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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.