MATLAB Answers


System.Typ​eInitializ​ationExcep​tion thrown initialising a MWNumericArray

Asked by Emanuele on 13 Jul 2014
Latest activity Commented on by NEETHU PRAKASH on 15 Dec 2016
I am trying to use in VS 2013 a .NET assembly made in MATLAB R2014a 64-bit, but a System.TypeInitializationException is thrown in correspondence of the following C# line: F = new MWNumericArray(3, 3, 3); My OS is Windows 8.1 64-bit. Can anyone help me?


Sign in to comment.

1 Answer

Answer by Nidhi Jain on 14 Jul 2014
 Accepted Answer

Hi Emanuele,
This looks like a 32bit-64bit mismatch issue. Please make sure that the platform selected in Visual Studio is 64-bit “x64”. If you do not have that option, try to add it using:
1. Open the project that you want to configure.
2. Open the property pages for that project.
3. Choose the Configuration Manager button to open the Configuration Manager dialog box.
4. In the Active Solution Platform drop-down list, select the <New…> option to open the New Solution Platform dialog box.
5. In the Type or select the new platform drop-down list, select a 64-bit platform.
Note: In the New Solution Platform dialog box, you can use the Copy settings from option to copy existing project settings into the new 64-bit project configuration.
6. Choose the OK button. The platform that you selected in the preceding step appears under Active Solution Platform in the Configuration Manager dialog box.
If the “64-bit” platform option is not available in the <New..> platform option, try the following:
1. Open Control Panel -> Uninstall or Change Programs
2. Select the appropriate version of Microsoft Visual Studio. Right lick and select “Uninstall/Change”
3. A window will open up, click on “Next” once the setup is completed.
4. Click on “Add/Remove features”
5. Expand the “Visual C++” option and make sure to check “x64 Compiler and Tools”
This should add the x64 option to Visual Studio.


hi, I also have the same problem.Till now it shows the System.Type Initialization Exception error.My system is windows 10.I can't done the steps given by Nidhi Jain.Actually i want to run .net dll file created using matlab 2014a.I need help. Thanks in advance.....

Sign in to comment.