I've updated my Phidget drivers and library using the new NuGet package from 1.0 to the latest (1.4.20190605).
Now I can't call the setter of the DigitalOutput.DutyCycle without getting an EntryPointNotFoundException like this:
"Unable to find an entry point named 'Phidget_getLastError' in DLL 'phidget22'."
I've noted this in the changelog which I guess has to do with this error:
- Add getLastError API for exposing extra error information.
If I revert back to version 1.0, I keep getting an PhidgetException with the errorcode NotAttached (which is probably since I'm using the new Windows drivers).
This means I'm currently stuck here and can't run my application for now.
Running the older library wouldn't cause an issue so the NotAttached is probably accurate and you need to make sure the device is correctly attaching, which might be why calling the set DutyCycle invoked a "getLastError" call. I'll try some other uses to see if I can replicate the issue you saw, can you share some code?
Anyhow, if the problem is that the device is not connected, I don't think it should throw an internal EntryPointNotFoundException. I would consider that a bug in the Phidgets library.
Well an EntryPointNotFound exception points toward a mismatch in dll's. I myself am not super familiar with the relationship between what you load in NuGET packages, and what you have installed on your machine from the website. I'm trying a variety of combinations of versions from both the website and installed nuget version, but can't cause the exception you're seeing.
Sounds like you couldn't find this link for old libraries, this might be useful for you. https://www.phidgets.com/downloads/
Our library dev is away, but there could be a library bug here I'm not seeing. We will see what we can do. For now, try installing older drivers and see if that helps
I've now fixed the immediate problem I had. The code was originally from a quite old version of the API, and I had made most migrations tasks when going to version 22. But I had missed that one call was synchronous before, and is asynchronous now. After fixing this, the attach issue is no longer present.
BUT: I think that there still is a bug if trying to set DutyCycle without having the device/channel attached. You should get a PhidgetException with the error code NotAttached (like in previous versions) and not an EntryPointNotFoundException. I have tried all NuGet package versions and they all have the same behavior.
Try deleting the packages folder and the bin folder and then reinstall the latest nuget library. I'm wondering if somehow the C dlls were not updated when the .NET library was updated. The nuget package includes it's own build of the C library, so it should not be possible to have this sort of mismatch.
You could also make sure the date on the bin/Debug/dll/x64/phidget22.dll file matches the bin/Debug/Phidget22.NET.dll
Also, can you enable native code debugging and on error have a look at the modules debug pane and ensure that the phidget22.dll is loaded from the bin/Debug/dll/x64 folder and not from somewhere else on the system.
I was missing the corresponding phidget dll... so find the proper dll in the 'dll' folder that gets created with your project. It's either in the 'x86' or 'x64' folder depending on your solutions platform and throw the 'phidget22.dll' in with your 'Phidget22 .NET.dll' dll.