Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easy way to crash VB.NET Program

I have a program up and going that interacts with hardware, but I need to test the case of when the program crashes/aborts or anything to cause the program to exit unnormally to see what state is set to the hardware when the software crashes.

In C++ I saw a post about using an abort() call (What is the easiest way to make a C++ program crash?), but I am unsure what the VB equivalent of that would be. The closest I have come is while debugging, to press the Stop Debugging button, but I think there is a better solution than that.

Is there any specific code that would cause this type of event to happen or is there a call like abort() that would make it happen in a heartbeat?

like image 973
StevenTsooo Avatar asked Aug 05 '13 20:08

StevenTsooo


1 Answers

Use the API Environment.FailFast. This is a .Net API accessible from any managed language including VB.Net. It will ruthlessly terminate the current process

  • Environment::FailFast
like image 109
JaredPar Avatar answered Oct 30 '22 21:10

JaredPar