How to supress unhandled exception and access violation error messages in Visual Studio debugging mode

5 次查看(过去 30 天)
When trying to debug(keyboard shortcut: F5) the dll which was generated from MATLAB Compiler SDK in visual studio by using single step debug, mclInitializeApplication(NULL,0) function run very slowly, and debug outputs lots of exception messages like below.
Exception thrown at 0x00007FFE9DCA9319 in matrix_exp_svr.exe: Microsoft C++ exception: mwboost::exception_detail::clone_impl<fl::filesystem::PathNotFound> at memory location 0x00000041850F9CA0.
Without using debug(keyboard shortcut: Ctrl-F5) like the following link's guidance, it works properly with the dll which was generated from MATLAB Compiler SDK. https://www.mathworks.com/matlabcentral/answers/748522-how-do-i-integrate-my-matlab-compiler-sdk-c-or-c-shared-library-in-visual-studio-2017

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2023-3-27
Please use the below code which is mentioned in the following manual.
const char *args[] = { "-nodisplay" }; 
if (! mclInitializeApplication(args, 1))
{
  fprintf(stderr, 
      "An error occurred while initializing: \n %s ",
      mclGetLastErrorMessage());
  return -1;  
}
You can replace "-nodisplay" with any option appropriate such as "-nojvm". "-nojvm" is mentioned in the same manual. "-nojvm" can only be used when there is no need for MATLAB graph. The app should not crash if "-nojvm" is not used but popup dialogue is possible. 
The popup in the debug session occurs anywhere since this is just a common thing that a dialogue can pop-up to give you a chance to break into the code to see what triggers the exception. It does not indicate there is a real issue. If you click continue and the app advances, it means the exception has been handled. Otherwise, it will keep popping up. Just remember, an exception can never be ignored and unhandled.
Note: The example given specifies "-nodisplay" option. This option is only applicable for Linux/Mac and ignored on Windows.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler SDK 的更多信息

标签

尚未输入任何标签。

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by