开发者

Do certain exception errors occur only in the debugger?

开发者 https://www.devze.com 2023-04-01 07:27 出处:网络
In a program I accidentally called closeHandle() twice on a mutex handle (closing the handle that was already closed).

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消