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 doe开发者_StackOverflows 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?
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.
精彩评论