Monday, February 22, 2010

Programmer - How to immediately exit a Windows Form application?

Programmer Question

In our app, we have a quite extensive exception handling mechanism. At some point in our error handling logic, we want to terminate the application -- right at this point with no further code execution. Our current code use Environment.Exit() to do that. After a call to Environment.Exit(), some code is still executed. For instance, the GC may execute the finalizer of some objects (and that causes a problem in our case). We don't want that to happen. Is there a way to really kill our own process (a win32 API call maybe)? Of course we don't want the end-user to see the Windows dialog that appears when a program crashes...

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails