DotNet MATLAB Runtime instance could not be initialized

44 次查看(过去 30 天)
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