5

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?

1
  • No idea if this is relevant to your situation but you might also want to look at the Application Events UnhandledException handler - you could maybe use this as a backstop to respond to (nearly) any exception and force the hardware into a known safe state. Commented Aug 6, 2013 at 13:57

1 Answer 1

6

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.