MadsKirkFoged / SharpFluids

Lightweight CoolProp C# Wrapper - for easy fluid properties lookups
MIT License
30 stars 9 forks source link

'The type initializer for 'CoolPropPINVOKE' threw an exception.' #39

Open kurupt44 opened 2 years ago

kurupt44 commented 2 years ago

Hello,

Thince few days I have this exception when I test my soft :

System.TypeInitializationException : 'The type initializer for 'CoolPropPINVOKE' threw an exception.' 1/2 : TypeInitializationException : The type initializer for 'SWIGExceptionHelper' threw an exception. 2/2 : BadImageFormatException : Tentative de chargement d’un programme de format incorrect. (0x8007000B)

This exception appear during test but is not exactly during a coolprop calcul.

Thank you,

Attemainio commented 1 year ago

Hello,

I have the same issue with this. Also, I cannot find symbols for debugging. .pdb file is missing from the assembly. I have tried to build my solution with different frameworks and to 32-bit and 64-bit versions with no luck.

EDIT: I decompiled the code and found this from the DoubleVector.cs class: image

EDIT 2: I think the issues is that this DoubleVector.cs class do not handle Environment.Is64BitProcess. Am I correct?

If this helps? image

MadsKirkFoged commented 1 year ago

You are correct that DoubleVector.cs did not handle 64Bit. I have accepted your commit - Can you test if you still get the error after the update?

Attemainio commented 1 year ago

I use the Nuget package of this repostory. Is it possible to create a new Nuget so I can test the validity of the function?

MadsKirkFoged commented 1 year ago

Nugets are automatic created when the code is being updated: It should be out: https://www.nuget.org/packages/SharpFluids/3.0.306

Attemainio commented 1 year ago

Thank you! :) It works perfectly!

Attemainio commented 1 year ago

This issue has been resolved