Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Environment.FailFast?

Tags:

c#

.net

vb.net

What is Environment.FailFast?

How is it useful?

like image 245
Embedd_0913 Avatar asked Feb 19 '09 09:02

Embedd_0913


2 Answers

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

like image 122
cgreeno Avatar answered Oct 05 '22 19:10

cgreeno


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

like image 26
Please treat your mods well. Avatar answered Oct 05 '22 19:10

Please treat your mods well.