Problem using COM automation server out of .net-Application

  • Follow


Good Evening, my name is Nisse and I am new to MATLAB Central, nevertheless I hope to find answers for my problems here. :)

I created an .net/c# WindowsForm-application with VS 2010. I am using MATLAB 2009b 64-Bit.

My app got following code, that's going to be executed on button_press:

MLApp.MLAppClass matlab = new MLApp.MLAppClass();

                matlab.Execute("a = [ 1 2 3 ; 4 5 6 ; 7 8 9];");
                matlab.Execute("plot(a);");

This whole thing is working perfectly fine, I am glad that this is so easy.
BUT NOW: the problem!
I sent this programm as an exe to my friend who uses MATLAB 2008a 32-Bit and when he executes the app, an error occurs.
So we tried it other way round: He wrote also the application with VS2010, just copied my code, compiled it and it worked fine!
Then he sent it to me, I tried: same error as he got when executing my file.
Could you tell me where the problem is? I am pretty sure it has to do with the different MATLAB versions.

Thanks for your help in advance,

your Nisse!

For better "debugging" I copy the error code that I got from his application to my thread: (the first part under "exception text" looks like the most important!)

"See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {491B6189-7E9D-43F4-A7DE-C062DF7B326E} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
   at egal.Form1.button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
egal
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Nisse/AppData/Local/Apps/2.0/BZAPR0HT.V4J/7MELO850.QK4/egal..tion_5768920476d774f4_0001.0000_bb3af84ff95733f7/egal.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Interop.MLApp
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Nisse/AppData/Local/Apps/2.0/BZAPR0HT.V4J/7MELO850.QK4/egal..tion_5768920476d774f4_0001.0000_bb3af84ff95733f7/Interop.MLApp.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box."
0
Reply Nisse 10/26/2010 7:11:04 PM

"Nisse Knudsen" wrote in message <ia7948$444$1@fred.mathworks.com>...
> Good Evening, my name is Nisse and I am new to MATLAB Central, nevertheless I hope to find answers for my problems here. :)
> 
> I created an .net/c# WindowsForm-application with VS 2010. I am using MATLAB 2009b 64-Bit.
> 
> My app got following code, that's going to be executed on button_press:
> 
> MLApp.MLAppClass matlab = new MLApp.MLAppClass();
> 
>                 matlab.Execute("a = [ 1 2 3 ; 4 5 6 ; 7 8 9];");
>                 matlab.Execute("plot(a);");
> 
> This whole thing is working perfectly fine, I am glad that this is so easy.
> BUT NOW: the problem!
> I sent this programm as an exe to my friend who uses MATLAB 2008a 32-Bit and when he executes the app, an error occurs.
> So we tried it other way round: He wrote also the application with VS2010, just copied my code, compiled it and it worked fine!
> Then he sent it to me, I tried: same error as he got when executing my file.
> Could you tell me where the problem is? I am pretty sure it has to do with the different MATLAB versions.
> 
> Thanks for your help in advance,
> 
> your Nisse!
> 
> For better "debugging" I copy the error code that I got from his application to my thread: (the first part under "exception text" looks like the most important!)
> 
> "See the end of this message for details on invoking 
> just-in-time (JIT) debugging instead of this dialog box.
> 
> ************** Exception Text **************
> System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {491B6189-7E9D-43F4-A7DE-C062DF7B326E} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
>    at egal.Form1.button1_Click(Object sender, EventArgs e)
>    at System.Windows.Forms.Control.OnClick(EventArgs e)
>    at System.Windows.Forms.Button.OnClick(EventArgs e)
>    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
>    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
>    at System.Windows.Forms.Control.WndProc(Message& m)
>    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
>    at System.Windows.Forms.Button.WndProc(Message& m)
>    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
>    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
>    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
> 
> 
> ************** Loaded Assemblies **************
> mscorlib
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
>     CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
> ----------------------------------------
> egal
>     Assembly Version: 1.0.0.0
>     Win32 Version: 1.0.0.0
>     CodeBase: file:///C:/Users/Nisse/AppData/Local/Apps/2.0/BZAPR0HT.V4J/7MELO850.QK4/egal..tion_5768920476d774f4_0001.0000_bb3af84ff95733f7/egal.exe
> ----------------------------------------
> System.Windows.Forms
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.0.30319.1 built by: RTMRel
>     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
> ----------------------------------------
> System.Drawing
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.0.30319.1 built by: RTMRel
>     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
> ----------------------------------------
> System
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.0.30319.1 built by: RTMRel
>     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
> ----------------------------------------
> System.Configuration
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
>     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
> ----------------------------------------
> System.Xml
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.0.30319.1 built by: RTMRel
>     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
> ----------------------------------------
> Interop.MLApp
>     Assembly Version: 1.0.0.0
>     Win32 Version: 1.0.0.0
>     CodeBase: file:///C:/Users/Nisse/AppData/Local/Apps/2.0/BZAPR0HT.V4J/7MELO850.QK4/egal..tion_5768920476d774f4_0001.0000_bb3af84ff95733f7/Interop.MLApp.DLL
> ----------------------------------------
> 
> ************** JIT Debugging **************
> To enable just-in-time (JIT) debugging, the .config file for this
> application or computer (machine.config) must have the
> jitDebugging value set in the system.windows.forms section.
> The application must also be compiled with debugging
> enabled.
> 
> For example:
> 
> <configuration>
>     <system.windows.forms jitDebugging="true" />
> </configuration>
> 
> When JIT debugging is enabled, any unhandled exception
> will be sent to the JIT debugger registered on the computer
> rather than be handled by this dialog box."





Hi dear:
I read your problem in the internet:
1. http://www.mathworks.com/matlabcentral/newsreader/view_thread/294857
2. http://compgroups.net/comp.soft-sys.matlab/Problem-using-COM-automation-server-out-of-net-Application
3. http://mathforum.org/kb/thread.jspa?messageID=7249825&tstart=0

I have a same problem, but can't solve it.
i develop a C# program by Matlab, but not running to another windows. because matlab didn't install on the another windows?

are you can find any solution?
Please help me and share your solution with me, if you find it.
Tanks,

Best regards.
A.Goodarzi
0
Reply goodarzi121 (1) 11/20/2011 3:44:13 PM


1 Replies
679 Views

(page loaded in 0.092 seconds)

Similiar Articles:













7/23/2012 7:20:02 PM


Reply: