Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
'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

Risposte (4)

Konstantin Tarkus
Konstantin Tarkus il 9 Lug 2013
Having exactly the same issue. Any ideas how to solve it?

Konstantin Tarkus
Konstantin Tarkus il 9 Lug 2013
Turned out it doesn't work on .NET 4.5 and also doesn't work when VS debugger is attached.

Friedrich
Friedrich il 9 Lug 2013
Hi,
try disabling the JIT from the C# side:
[assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]
Does it work now?
  3 Commenti
tri truong
tri truong il 11 Ago 2014
I have same your problem. I try added [assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]. still fail. help me plase

Accedi per commentare.


Jonathan
Jonathan il 17 Gen 2015
Modificato: Jonathan il 17 Gen 2015
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 Commento
Anatoly Khamukhin
Anatoly Khamukhin il 25 Gen 2018
Modificato: Anatoly Khamukhin il 25 Gen 2018
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

Accedi per commentare.

Categorie

Scopri di più su Software Development Tools in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by