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

5 views (last 30 days)
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?

Accepted Answer

Nidhi Jain
Nidhi Jain on 14 Jul 2014
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.
  2 Comments
NEETHU PRAKASH
NEETHU PRAKASH on 15 Dec 2016
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.

More Answers (0)

Categories

Find more on Java Package Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!