Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Escape and Ignore __debugbreak

Tags:

c#

.net

dll

I'm using DLLImport to import a library provided by a hardware company and I'm writing my code in .NET Framework to consume the API provided by the DLL.

In one of the methods, when triggered, Visual Studio returns "A breakpoint instruction (__debugbreak() statement or a similar call) was executed in XXX.exe." while I'm in Debug mode. When switching to Release mode, the application crash and Visual Studio just stop the execution.

How do I escape the error/debugbreak so the application won't be triggering this error or I can bypass it?

like image 915
JeeShen Lee Avatar asked Oct 29 '25 07:10

JeeShen Lee


1 Answers

After a few days of research, it turns out that the error was caused by a memory leakage "0xC0000374: A heap has been corrupted".

It was because of the memory leakage, it triggers the __debugbreak. The DLL library owner confirms that there's none __debugbreak in their code.

More information of how to solve the memory leaks is covered in this StackOverflow thread.

like image 139
JeeShen Lee Avatar answered Oct 31 '25 22:10

JeeShen Lee