Borrar filtros
Borrar filtros

DotNet MATLAB Runtime instance could not be initialized

51 visualizaciones (últimos 30 días)
mika
mika el 18 de En. de 2016
Respondida: Roberto Olmi el 27 de Sept. de 2020
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 comentario
Harsheel
Harsheel el 22 de En. de 2016
Editada: Harsheel el 22 de En. de 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?

Iniciar sesión para comentar.

Respuesta aceptada

mika
mika el 9 de Mayo de 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 comentarios
Chris Money
Chris Money el 2 de Feb. de 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 el 2 de Feb. de 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!

Iniciar sesión para comentar.

Más respuestas (2)

Wenchao Tao
Wenchao Tao el 4 de Mayo de 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 comentarios
Edwardo Medina
Edwardo Medina el 23 de En. de 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 el 23 de En. de 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.

Iniciar sesión para comentar.


Roberto Olmi
Roberto Olmi el 27 de Sept. de 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).

Categorías

Más información sobre Deploy to .NET Applications Using MWArray API en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by