DotNet MATLAB Runtime instance could not be initialized

18 visualizzazioni (ultimi 30 giorni)
I've got the exception 'The MATLAB Runtime instance could not be initialized segv - SEVERE ERROR'.
StackTrace: bei MathWorks.MATLAB.NET.Utility.MWMCR..ctor(String componentId, String componentPath, Stream embeddedCtfStream, Boolean isLibrary)
I have a MATLAB-Script which is compiled as .NET-Assembly. And I tried to run this Skript from C#. An previous Version of the scipt worked with the MATLAB-Runtime 8.5 without Problems. When it was compiled with a new MATLAB-Compiler-Version, I had to install the MATLAB-Runtime 9.0 to include the new MWArray.dll v2.15.1.0. And now the first call to this script ends in this exception.
I tried different Versions of the Runtime (8.5, 8.5.1, 9.0, 32bit, 64bit) without success. I use .NET 4.5, Windows 7 Pro 64bit. .NET-Assembly with the MATLAB-script and C#-Program should be 64 bit.
  1 Commento
Harsheel
Harsheel il 22 Gen 2016
Modificato: Harsheel il 22 Gen 2016
  • Are you sure that the MCR bit-ness is same as the MATLAB bit-ness from which the application was compiled?
  • Are you sure that the MCR you have installed appears before any other MCR on the Windows PATH?

Accedi per commentare.

Risposta accettata

mika
mika il 9 Mag 2018
Hi, this error message might be a litle deceptive. In my case the dll was created with a trail licence. A few weeks after compilation the dll was inoperative, but the error message only says "The MCR instance could not be initialized"...
  2 Commenti
Chris Money
Chris Money il 2 Feb 2019
Thank you for posting this I ran into the exact same thing! It was quite frustating to figure out what was going on! Who would have figured they would make their dll's expire when created from trial version!
Chris Money
Chris Money il 2 Feb 2019
If the DLL expires, surely they can have better error message, "DLL created from trial has expired," etc I spent 3+ hours trying to figure out why the application was no longer working!

Accedi per commentare.

Più risposte (2)

Wenchao Tao
Wenchao Tao il 4 Mag 2018
Hi, I'm wondering if you have solution to this problem. I'm using Matlab 2013a and compiling matlab codes to dll for .net application used under windows 7/10. Using Visual Studio 2005.Sometime, random error happens with System.Exception: The MCR instance could not be initialized. A restart sometime solve the error, but I want to make it more reliable. Any help regarding this will be really helpful.
  2 Commenti
Edwardo Medina
Edwardo Medina il 23 Gen 2019
I am experiencing this same issue. When I first call to init matlab runtime I get a "Exception thrown at 0x6E72313D (jvm.dll) in MatlabPOC.exe: 0xC0000005: Access violation writing location 0x078F0880" and the matlab portion of my app fails. The initialization works the second time I start the app and everything works file.
Guillaume
Guillaume il 23 Gen 2019
"I am experiencing this same issue"
Not at all. The question is about a seg fault in the .Net runtime. Yours is about a seg fault in the java virtual machine, two completely different environments. Therefore you should start your own separate question. However, for problems like this you may be better off contact Mathworks support directly.

Accedi per commentare.


Roberto Olmi
Roberto Olmi il 27 Set 2020
I had the same issue. It seems that the root cause was that I deleted one file containing a function that was called by matlab code. No error was thrown because a copy of the deleted file was in Matlab path (containing a different version of the matlab project).

Community Treasure Hunt

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

Start Hunting!

Translated by