. NET calls to Matlab to generate DLL problems (the type initializer for ' MathWorks?). Matlab.ne? T.utility.? MWMCR ' threw an exception.)

Source: Internet
Author: User

https://cn.mathworks.com/matlabcentral/answers/278399- I-get-an-error-saying-the-type-initializer-for-mathworks-matlab-net-utility-mwmcr-threw-an-except

This article helped solve the problem.

Record the memo:

Hi Nug,

Ensure that's the MCR version corresponding to MATLAB 2012b installed. You can check this from the following link.

MATLAB Runtime

After ensuring the correct version of MCR, it'll be useful to check the system path. If you had either MATLAB or any other version of the MCR installed on your machine, please make sure that the one is run Ning the deployable against appears higher in the system path than any other MATLAB/MCR runtime.

To view or change environment variables:

    1. Right-click My Computer, and then click Properties.
    2. Click the Advanced tab.
    3. Click environment variables.
    4. In the ' System Variables ' search for the variable named ' Path ' and ensure, the MCR installation for r2012b appears hig Her than in the path than any other MATLAB/MCR runtime

Also, is you using the Web installed MCR or the packaged MCR?

There might be, possible causes for the error to appear:

A) This error can appear if your copied the MATLAB Runtime DLL Mclmcrrt8_0.dll to the folder that contains your. NET applic ation or to some other Windows system folder. If you copy this MATLAB DLL to another folder, then it tries to find it further dependencies it would fail.

To work around this issue, remove any unnecessary copies of the file and leave the file in the installation folder Belongi Ng to MATLAB or the MCR.

B) The issue might be due to the fact, the packaged MCR installation is not adding the mwarray properly to the machine Global Assembly Cache (GAC). In such a case, the deployed component picks up the older Mwarray already installed in the GAC and fails. The GAC preempts other references so even if you specifically reference the r2015a Mwarray by browsing to it and Referenci ng it in Visual Studio.

In order to workaround the issue you would need to either:

    1. Uninstall the other mwarrays from the GAC (so do sure it picks up the referenced Mwarray)
    2. Add the r2012b Mwarray into the GAC using Microsoft ' s gacutil.exe. More information on this can seen from the link below:

Http://msdn.microsoft.com/en-us/library/dkkx7f79 (v=vs.110). aspx

I Hope either of the above workarounds helps you and resolve this issue.

-rohit

. NET calls to Matlab to generate DLL problems (the type initializer for ' MathWorks?). Matlab.ne? T.utility.? MWMCR ' threw an exception.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.