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
Message | Probable Cause | Suggested Solution |
---|---|---|
LoadLibrary(" | 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. | |
Error in
| This is often caused by |
( |
Error in VBAProject: ActiveX component can't create
object. |
| If the DLL is not registered,
( |
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 | Work around this problem by doing the following:
|
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:
try { Magic magic = new Magic(); magic.callmakeerror(); } 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 ... at file C:\work\MagicDemoCSharpApp\bin\Debug\ CalldmakeerrComp_mcr\compiler\g388611\ca thy\MagicDemoComp\dmakeerror.m,name dmakeerror_error2,line at 14. at file C:\work\MagicDemoCSharpApp\bin\Debug\ CalldmakeerrComp_mcr\compiler\work\MagicDemoComp\dmakeerror.m,name dmakeerror_error1,line at 11. at file C:\work\MagicDemoCSharpApp\bin\Debug\ CalldmakeerrComp_mcr\compiler\work\MagicDemoComp\dmakeerror.m,name dmakeerror,line at 4. at file C:\work\MagicDemoCSharpApp\bin\Debug\ CalldmakeerrComp_mcr\compiler\work\MagicDemoComp\calldmakeerror.m,name 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 C:\work\MagicDemoComp\src\ Calldmakeerr.cs:line 140 at MathWorks.Demo.MagicSquareApp.MagicDemoApp.Main(String[] args) in C:\work\Ma gicDemoCSharpApp\MagicDemoApp.cs:line 52