What is Environment.FailFast?

It also creates a dump and event viewer entry, which might be useful.


It is used to kill an application. It's a static method that will instantly kill an application without being caught by any exception blocks.

Environment.FastFail(String) can actually be a great debugging tool. For example, say you have an application that is just downright giving you some weird output. You have no idea why. You know it's wrong, but there are just no exceptions bubbling to the surface to help you out. Well, if you have access to Visual Studio 2005's Debug->Exceptions... menu item, you can actually tell Visual Studio to allow you to see those first chance exceptions. If you don't have that, however you can put Environment.FastFail(String) in an exception, and use deductive reasoning and process of elimination to find out where your problem in.

Reference


It's a way to immediately exit your application without throwing an exception.

Documentation is here.

Might be useful in some security or data-critical contexts.

Tags:

C#

.Net

Vb.Net