Process.WaitForExit not triggering with __debugbreak

Posted by Cypher2100 on Stack Overflow See other posts from Stack Overflow or by Cypher2100
Published on 2010-03-29T00:39:25Z Indexed on 2010/03/29 0:43 UTC
Read the original article Hit count: 195

Filed under:
|
|
|

I'm trying to write a program to test student code against a good implementation. I have a C++ console app that will run one test at a time determined by the command line args and a C# .net forms app that calls the c++ app once for each test. The goal is to be able to detect not just pass/fail for each test, but also "infinite" (>5secs) loop and exceptions (their code dying for whatever reason).

The problem is that not all errors kill the C++ app. If they corrupt the heap the system calls __debugbreak which pops up a window saying Debug Error! HEAP CORRUPTION DETECTED... My C# app is using Process.WaitForExit(5000) to wait, but this error doesn't count as an exit, so I see a timeout.

So my question is, how can I either get the C# app to detect that this is an error OR how can I get the C++ app to die when this error occurs rather than giving a dialog box and asking if I want to debug?

© Stack Overflow or respective owner

Related posts about c#

Related posts about c++