I’m getting an inconsistent crash inside HidSharp.
The method in HidSharp is below:
public unsafe override void GetFeature(byte[] buffer, int offset, int count)
{
Throw.If.OutOfRange(buffer, offset, count);
HandleAcquireIfOpenOrFail();
try
{
fixed (byte* ptr = buffer)
{
if (!NativeMethods.HidD_GetFeature(_handle, ptr + offset, count))
{ throw new IOException("GetFeature failed.", new Win32Exception()); } <------------ exception here
}
}
finally
{
HandleRelease();
}
}
Here is my call stack at the time:
HidSharp.dll!HidSharp.Platform.Windows.WinHidStream.GetFeature(byte[] buffer, int offset, int count) Line 78
BlinkStickDotNet.dll!BlinkStickDotNet.BlinkStick.GetColors(out byte[] colorData) Line 790
BlinkStickDotNet.dll!BlinkStickDotNet.BlinkStick.GetColor(byte index, out byte r, out byte g, out byte b) Line 824
BlinkStickDotNet.dll!BlinkStickDotNet.BlinkStick.Morph(byte channel, byte index, byte r, byte g, byte b, int duration, int steps) Line 1016
BlinkStickDotNet.dll!BlinkStickDotNet.BlinkStick.Pulse(byte channel, byte index, byte r, byte g, byte b, int repeats, int duration, int steps) Line 1118C#
BlinkStickDotNet.dll!BlinkStickDotNet.BlinkStick.Pulse(byte channel, byte index, BlinkStickDotNet.RgbColor color, int repeats, int duration, int steps) Line 1137
BlinkStickDotNet.dll!BlinkStickDotNet.BlinkStick.Pulse(byte channel, byte index, string color, int repeats, int duration, int steps) Line 1150
CheckForMeetingReminders.exe!CheckForMeetingReminders.Program.AnimationForEmails() Line 270
And here is the code that I called that caused the issue:
Line 270: device.Pulse(0,1,"green");
Am I doing something wrong? Yes I’ve opened the device, and this is basically based on code in the .NET Examples.
Yes this is a Nano, and I was trying to access the second LED. If I use
device.Pulse("green");
I haven’t seen the issue.