Why do I get "Type initializer throws an exception" error every time the compiled class is instantiated while creating a .NET Application with MATLAB Code?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 2 Okt. 2017
Beantwortet: MathWorks Support Team
am 26 Feb. 2018
I'm trying to compile some Matlab code to a .NET library and use it in a C# application. I am following the step-by-step instructions from "Create a .NET Application with MATLAB Code" but I get a
"Type initializer threw an exception" error every time I try to instantiate the compiled class.
Akzeptierte Antwort
MathWorks Support Team
am 2 Okt. 2017
This issue is related to the 32/64 bit differences between Matlab and Visual studio.
There is a workaround for this.
You can manage to get it working by changing your Visual Studio application properties "Platform target" to x64 and the target .NET framework to the Microsoft framework the .NET builder option.
If your "Plaform target" setting is set to "Any CPU", the "Prefer 32 bit" option under it must be unchecked for compilation to happen correctly.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Compiler SDK finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!