Beginner Question - C# Exception Handling - Can't Understand MSDN Example

If you really want to kill the process, use Environment.FailFast() instead of Application.Exit(). More info about FailFast can be found here: http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx


Answer this question

Beginner Question - C# Exception Handling - Can't Understand MSDN Example

  • cdeck

    Rephrase last sentence:

    what is the value that this Environment.FailFast is supposed to be adding when I can just use Environment.Exit();

  • Lord_MiL

    When I experimented with FailFast I called it like this:

    Environment.FailFast("Asta La Vista Baby");

    When the above line executes a fancy message box is shown with two buttons - Debug and Close.  The message on the message box is what I wrote above and I cannot see "Asta La Vista Baby" anywhere on the message box.

    Are you saying that you see a "send" button on your version   I would be interested to know where it is being sent   Back to Redmond

    If there is Send functionality then I can see the usefulness of FailFast, but if there is no send button I would just use Environment.Exit


  • LHarrison

    From the comments of the blog article I posted before:

    System.Environment.FailFast offers the user a chance to send an error report, then terminates the process. (It's the nicer managed equivalent to calling ExitProcess when you decide you really can't go on.) If you're writing a class library you probably don't want to use FailFast--at least not if you like having customers :-D. If you're writing an application, though, it often makes sense if you really want the process to die. Exceptions can be caught; FailFast just kills the process right away.

  • Insecurity

    Thanks for replying Daniel, however I could not glean any really useful information about FailFast from the link.

    I experimented with FailFast and found that:
    (1) It ignores the "Message" parameter that I send to it
    (2) The only functionality it appears to acieve is to show a message:

    "blah.exe has encountered a problem and needs to close.  We are sorry for the inconvenience.  If you were in the middle of something the information you were working on might be lost"

    Errm, what is the value that this Environment.FailFast is supposed to be adding

    TIA
    Bill

  • Beginner Question - C# Exception Handling - Can't Understand MSDN Example