Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do certain exception errors occur only in the debugger?

In a program I accidentally called closeHandle() twice on a mutex handle (closing the handle that was already closed).

When running the code in the debugger, I received the exception error An invalid HANDLE was specified. as expected.

However, running the program "normally" as a stand alone (outside of the debugger) the exception does not appear or any other error. Program appears to run normally.

Is this just a setting in Visual Studio .NET 2003 or is there more behind it?

like image 864
T.T.T. Avatar asked Aug 31 '11 18:08

T.T.T.


1 Answers

The documentation states:

If the application is running under a debugger, the function will throw an exception if it receives either a handle value that is not valid or a pseudo-handle value. This can happen if you close a handle twice, or if you call CloseHandle on a handle returned by the FindFirstFile function instead of calling the FindClose function.

like image 87
David Heffernan Avatar answered Sep 20 '22 21:09

David Heffernan