What is Environment.FailFast?

后端 未结 7 1751
别那么骄傲
别那么骄傲 2021-02-01 14:05

What is Environment.FailFast?

How is it useful?

7条回答
  •  隐瞒了意图╮
    2021-02-01 14:34

    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

提交回复
热议问题