Calling new on Matlab Generated Class from Dot Net Crushes the App (m_interpreter.dll)

2 ビュー (過去 30 日間)
Dani Kaplan
Dani Kaplan 2013 年 6 月 20 日
編集済み: Anatoly Khamukhin 2018 年 1 月 25 日
've compiled a little program using matlab 2013 I can see in my dll: Test.TestMethods all my functions
I've added it as a reference to my dot net project, and added the MWArray dll from matlab bin\win64\v2.0 folder.
I've set my program to build against X64.
Once I try to create the object:
Test.TestMethods test = new Test.TestMethods();
My App crashes. I can only see in external Visual Studio instance:
Unhandled exception at 0x0000000001D36E60 (m_interpreter.dll).
Access violation reading location 0x00000000A5CE3920.
I have no idea where to start....
EDIT1: this is the ctor (there is also a static cctor):
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ldsfld class [mscorlib]System.Exception Test.TestMethods::ex_
IL_000b: brfalse.s IL_0013
IL_000d: ldsfld class [mscorlib]System.Exception Test.TestMethods::ex_
IL_0012: throw
IL_0013: ret
} // end of method TestMethods::.ctor

回答 (4 件)

Konstantin Tarkus
Konstantin Tarkus 2013 年 7 月 9 日
Having exactly the same issue. Any ideas how to solve it?

Konstantin Tarkus
Konstantin Tarkus 2013 年 7 月 9 日
Turned out it doesn't work on .NET 4.5 and also doesn't work when VS debugger is attached.

Friedrich
Friedrich 2013 年 7 月 9 日
Hi,
try disabling the JIT from the C# side:
[assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]
Does it work now?
  3 件のコメント
Friedrich
Friedrich 2013 年 7 月 15 日
Any update on this? Did it work?
tri truong
tri truong 2014 年 8 月 11 日
I have same your problem. I try added [assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]. still fail. help me plase

サインインしてコメントする。


Jonathan
Jonathan 2015 年 1 月 17 日
編集済み: Jonathan 2015 年 1 月 17 日
I am having a very similiar issue. My however is intermittent, it appears to be dependent upon the activity on the system. During periods of low usage it seems to work fine at high usage, the application calling the {dll_name}Initilize() call crashes in the m_interperter.dll...
I am using the -nojit
const char *pStrings[] = { "-nojit" };
mclInitializeApplication(pStrings, 0);
seems to behave the same either way...
please help...
-Chad
  1 件のコメント
Anatoly Khamukhin
Anatoly Khamukhin 2018 年 1 月 25 日
編集済み: Anatoly Khamukhin 2018 年 1 月 25 日
You were so close to finish... Replace 0 to 1 (it is count of items in pStrings). You were so close to finish... Replace 0 to 1 (it is count of items in pStrings). Also "-nojit" seems to be obsolete now (Matlab2017).
const char *args[] = {"-nojvm"};
const int count = sizeof(args) / sizeof(args[0]);
mclInitializeApplication(args, count))
solved the problem for me

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Compiler SDK についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by