Main Content

Diagnostic Messages

The following table shows diagnostic messages you might encounter, probable causes for the message, and suggested solutions.

See the following table for information about some diagnostic messages.

Diagnostic Messages and Suggested Solutions

MessageProbable CauseSuggested Solution
LoadLibrary("component_name_1_0.dll") failed - The specified module could not be found.

You may get this error message while registering the project DLL from the DOS prompt. This can occur if the MATLAB® Runtime is not on the system path.

See Failure to Find MATLAB Runtime Files.

Error in component_name.class_name.x: Error getting data conversion options.

This is often caused by mwcomutil.dll not being registered.

  1. Open a DOS window.

  2. Change folders to matlabroot\bin\win64.

  3. Run the following command: mwregsvr mwcomutil.dll

(matlabroot is your root MATLAB folder.)

Error in VBAProject: ActiveX component can't create object.
  • Project DLL is not registered.

  • An incompatible MATLAB DLL exists somewhere on the system path.

If the DLL is not registered,

  1. Open a DOS window.

  2. Change folders to projectdir\distrib.

  3. Run the following command: mwregsvr projectdll.dll

(projectdir represents the location of your project files).

object ref not set to instance of an object

This occurs when an object that has not been instantiated is called

Instantiate the object.

Error in VBAProject: Automation error The specified module could not be found.

This usually occurs if MATLAB is not on the system path.

See Failure to Find MATLAB Runtime Files.
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

This warning occurs when ASP.NET code tries to bring up a dialog box.

If occurs because getframe() makes the figure window visible before performing the capture and thus fails when running in IIS. msgbox() calls in MATLAB code cause the warning to appear also.

Work around this problem by doing the following:

  1. Open the Windows Control Panel.

  2. Open Services.

  3. From the list of services, select and open the IIS Admin service.

  4. In the Properties dialog, on the Log On tab, select Local System Account.

  5. Select the option Allow Service to Interact with Desktop.

Enhanced Error Diagnostics Using mstack Trace

Use this enhanced diagnostic feature to troubleshoot problems that occur specifically during MATLAB code execution.

To implement this feature, use .NET exception handling to invoke the MATLAB function inside of the .NET application, as demonstrated in this try-catch code block:

Magic magic = new Magic(); 
catch(Exception ex) 
Console.WriteLine("Error: {0}", exception); 

When an error occurs, the MATLAB code stack trace is printed before the Microsoft® .NET application stack trace, as follows:

... MATLAB code Stack Trace ... 
file C:\work\MagicDemoCSharpApp\bin\Debug\
dmakeerror_error2,line at 14. 
file C:\work\MagicDemoCSharpApp\bin\Debug\
dmakeerror_error1,line at 11. 
file C:\work\MagicDemoCSharpApp\bin\Debug\
CalldmakeerrComp_mcr\compiler\work\MagicDemoComp\dmakeerror.m,name dmakeerror,line at 4. 
file C:\work\MagicDemoCSharpApp\bin\Debug\
calldmakeerror,line at 2. 

... .Application Stack Trace ... 
   at MathWorks.MATLAB.NET.Utility.MWMCR.EvaluateFunction
(String functionName, Int32 numArgsOut, Int 
32 numArgsIn, MWArray[] argsIn) 
   at MathWorks.MATLAB.NET.Utility.MWMCR.EvaluateFunction
(Int32 numArgsOut, String functionName, MWA 
rray[] argsIn) 
   at CalldmakeerrComp.Calldmakeerr.calldmakeerror() in 
Calldmakeerr.cs:line 140 
   at MathWorks.Demo.MagicSquareApp.MagicDemoApp.Main(String[]
 args) in C:\work\Ma 
gicDemoCSharpApp\MagicDemoApp.cs:line 52