DarthAffe / RGB.NET

The one-stop SDK for RGB-peripherals

Home Page:http://lib.arge.be

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArgumentNullException When trying to Load Corsair Devices

MetalHexx opened this issue · comments

I receive the following:

System.ArgumentNullException: 'Value cannot be null. Parameter name: ptr'

when trying to initialize Corsair devices with the following code:

var surface = RGBSurface.Instance;
surface.LoadDevices(new CorsairDeviceProviderLoader().GetDeviceProvider(), throwExceptions: true);
surface.AlignDevices();

Of course, it doesn't throw the exception when I omit throwExceptions: true. However, when I try to view surface.Devices, the IEnumerable is empty.

Could you post the traceback message so we can run it down?

I'll get it to you tonight when I'm in front of the machine. But I snagged the source code for RGB.net and it seems to occur when loading the CUESDK_2015.dll. I think that's the file name anyways. And just FYI, the older Cue.net library seems to work fine.

Here is the stacktrace. The code I'm having trouble with can be found here: https://github.com/MetalHexx/iHue/blob/master/iHue.App/RgbDeviceManager.cs

System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null.
Parameter name: ptr
Source=mscorlib
StackTrace:
at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(IntPtr ptr, Type t)
at RGB.NET.Devices.Corsair.Native._CUESDK.LoadCUESDK() in C:\dev\src\3rd\RGB.NET\RGB.NET.Devices.Corsair\Native_CUESDK.cs:line 45
at RGB.NET.Devices.Corsair.Native._CUESDK.Reload() in C:\dev\src\3rd\RGB.NET\RGB.NET.Devices.Corsair\Native_CUESDK.cs:line 31
at RGB.NET.Devices.Corsair.CorsairDeviceProvider.Initialize(RGBDeviceType loadFilter, Boolean exclusiveAccessIfPossible, Boolean throwExceptions) in C:\dev\src\3rd\RGB.NET\RGB.NET.Devices.Corsair\CorsairDeviceProvider.cs:line 174
at RGB.NET.Core.RGBSurface.LoadDevices(IRGBDeviceProvider deviceProvider, RGBDeviceType loadFilter, Boolean exclusiveAccessIfPossible, Boolean throwExceptions) in C:\dev\src\3rd\RGB.NET\RGB.NET.Core\RGBSurfaceDeviceLoader.cs:line 35
at iHue.App.RgbDeviceManager.Initialize() in c:\dev\src\projects\iHue\iHue.App\RgbDeviceManager.cs:line 30
at iHue.App.RgbDeviceManager..ctor(Subject`1 colorStream) in c:\dev\src\projects\iHue\iHue.App\RgbDeviceManager.cs:line 23
at iHue.App.Program.Main(String[] args) in c:\dev\src\projects\iHue\iHue.App\Program.cs:line 17

Are you using the SDK-dll provided by the RGB.NET-Respurce-Package or did you copy a own in?
It seems like the SDK version is missing one of the methods used by RGB.NET.

I just found your resources in this repo and it seems to have gotten me passed the error. I can now see devices. Thanks for pointing that out and for everyone being so responsive. :)

Just curious, is this missing method something that the newer SDK deprecated or is it a fork? What are the future plans to keep up with the lastest versions of corsairs SDK? Thanks a ton for all your work. Hopefully I can get this Hue Sync clone working so corsair customers can enjoy that feature.

I've no idea. Corsair isn't realeasing anouncements or changelogs for the SDK (just like all the other manufacturers) which makes it quite hard to keep track of what's changing.
I'm trying to keep the SDKs up to date (especially if there things like improved device support etc in it) though.