I'd like to prevent "Debug assertion failed window" appearing in Visual studio C++ 2022 on errors handled by the debugger, in a way like I pressed "Retry" in this window to get straight to the code.
Justification
Is this possible keeping debug assertions working and debugger handling these things? I just want to skip the window.
Thanks to John Omielan's comment above, the answer from here: Windows CRT and assert reporting (abort, retry, ignore) solved the problem:
int __cdecl CrtDbgHook(int nReportType, char* szMsg, int* pnRet)
{
return TRUE;//Return true - Abort,Retry,Ignore dialog will *not* be displayed
return FALSE;//Return false - Abort,Retry,Ignore dialog *will be displayed*
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
_CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook);
assert(false);
getch();
return 1;
}