DotNet MATLAB Runtime instance could not be initialized

조회 수: 43 (최근 30일)
mika
mika 2016년 1월 18일
답변: Roberto Olmi 2020년 9월 27일
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
Harsheel
Harsheel 2016년 1월 22일
편집: Harsheel 2016년 1월 22일
  • 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?

댓글을 달려면 로그인하십시오.

채택된 답변

mika
mika 2018년 5월 9일
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
Chris Money
Chris Money 2019년 2월 2일
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 2019년 2월 2일
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!

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Wenchao Tao
Wenchao Tao 2018년 5월 4일
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
Edwardo Medina
Edwardo Medina 2019년 1월 23일
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 2019년 1월 23일
"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.

댓글을 달려면 로그인하십시오.


Roberto Olmi
Roberto Olmi 2020년 9월 27일
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).

카테고리

Help CenterFile Exchange에서 Deploy to .NET Applications Using MWArray API에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by