System.TypeInitializationException when using a .NET library compiled with MATLAB 32-bit in C#
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
David Kelly
le 1 Juin 2015
Réponse apportée : Guillaume
le 4 Juin 2015
I have compiled a .NET library using MATLAB 32-bit compiler and attempted to use it in a 32-bit C# application. When instantiating the class, I am getting a System.TypeInitializationException.
Please note the following:
- I have set the Configuration Manager in Visual Studio to x86 (32-bit)
- I am referencing MWArray.dll from the 32-bit installation of the MCR
- I have compiled my .NET library using the 32-bit version of MATLAB
- I have correctly installed the 32-bit version of the MATLAB compiler runtime
- I have already run gacutil.exe on the 32-bit version of MWArray.dll to register it in the GAC
- My machine is Windows 7 64-bit
I have called MATLAB support and have not received a solution at this time.
2 commentaires
Réponse acceptée
Plus de réponses (1)
Guillaume
le 4 Juin 2015
The BadImageFormatException is the real cause of the error. Do any of its property (maybe FusionLog) give any hint about why it fails to load the assembly?
All the possible cause for this exception are listed here. One possible cause is that your C# application uses a different version of the .Net framework. Which version does your matlab dll target and which version does your exe target?
0 commentaires
Voir également
Catégories
En savoir plus sur MATLAB Compiler SDK dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!