Skip to content

Using SharpFluids in a .Net 4.6.1 Class Library, getting 'Coolprop.dll not found' error after rebuilds #36

@Sean-Hasse

Description

@Sean-Hasse

I've been getting an inconsistent issue with SharpFluids since changing a project to a library to add to another, larger project. The first time my project tries to create a fluid with 'Fluid f = new Fluid(FluidList.Water);' I get an exception. It appears that the code is not finding the CoolProp.dll when it tries to convert the FluidList object to a Fluid object. I've confirmed that the CoolProp.dll is present in the Debug folder, and that I'm properly calling 'using SharpFluids;' at the start and all.

Mystifyingly, the workaround I've found so far is to comment out that first 'Fluid f =' line, let my code run, and after it crashes because Fluid f is a null reference object, I un-comment out that code and it runs perfectly fine.

I suspect it's either an issue with the loading order for my project, or maybe it's an issue with the .Net framework I'm using. Any insights at all would be appreciated.

Additional Information:
SharpFluids being used is version 3.0.270 but has been observed on multiple versions
The full error is this: System.TypeInitializationException: The type initializer for 'CoolPropPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CoolProp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions