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

24 views (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Mar 2023
Edited: MathWorks Support Team on 27 Mar 2023
Please use the below code which is mentioned in the following manual.
const char *args[] = { "-nodisplay" }; 
if (! mclInitializeApplication(args, 1))
      "An error occurred while initializing: \n %s ",
  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.

More Answers (0)


Find more on C Shared Library Integration in Help Center and File Exchange


No tags entered yet.




Community Treasure Hunt

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

Start Hunting!

Translated by