Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is thrown when using .NET Core #2

Open
Urmel11 opened this issue Jun 1, 2018 · 5 comments · May be fixed by #3
Open

Exception is thrown when using .NET Core #2

Urmel11 opened this issue Jun 1, 2018 · 5 comments · May be fixed by #3

Comments

@Urmel11
Copy link
Member

Urmel11 commented Jun 1, 2018

As reported in issue #1, the library throws following System.ArgumentException when using .NET Core.

Unhandled Exception: System.ArgumentException: Object contains non-primitive or non-blittable data.
   at System.Runtime.InteropServices.GCHandle.InternalAlloc(Object value, GCHandleType type)
   at System.Runtime.InteropServices.GCHandle.Alloc(Object value, GCHandleType type)
   at rpi_ws281x.WS281x..ctor(Settings settings) in /home/daniel/Documents/RPI/rpi-ws281x-csharp/src/rpi_ws281x/WS281x.cs:line 28
   at TestAppCore.ColorWipe.Execute(AbortRequest request) in /home/daniel/Documents/RPI/rpi-ws281x-csharp/src/TestAppCore/ColorWipe.cs:line 27
   at TestAppCore.Program.Main(String[] args) in /home/daniel/Documents/RPI/rpi-ws281x-csharp/src/TestAppCore/Program.cs:line 38
@Urmel11 Urmel11 mentioned this issue Jun 1, 2018
@DanielSSilva
Copy link

As stated here , your code works because there's a bug on mono (how ironic is that right?). Later I'll try the given solution and report back here

@DanielSSilva
Copy link

I've got it working. Basically I've done what they suggested, removed the array and set 2 fields

@tillig
Copy link

tillig commented Jan 28, 2019

@DanielSSilva I'm coming in late to this, but are you saying you changed ws2811_t to look like this?

    [StructLayout(LayoutKind.Sequential)]
    internal struct ws2811_t
    {
        public long render_wait_time;
        public IntPtr device;
        public IntPtr rpi_hw;
        public uint freq;
        public int dmanum;
        public ws2811_channel_t channel_0;
        public ws2811_channel_t channel_1;
    }

I did that and got past the blittable error and am now into some invalid GPIO pin errors, but that may just mean me having to work through required changes based on the above. Just wanted to make sure I'm on the right track.

@DanielSSilva
Copy link

Hello @tillig. IIRC what I've done was something like that yes.
https://github.com/rpi-ws281x/rpi-ws281x-powershell/blob/master/src/Native/ws2811_t.cs#L16-L17
On that repo there's this project but with that small change on my side. Although that seemed to work, I've had some segmentation fault errors :(
I haven't got back to it, but if you need any help ping me!

@tillig
Copy link

tillig commented Jan 28, 2019

@DanielSSilva Awesome, thanks! I'm going to continue muscling through and will ping you if needed - I appreciate that offer.

ryaneverett33 added a commit to ryaneverett33/rpi-ws281x-csharp that referenced this issue Sep 13, 2019
@ryaneverett33 ryaneverett33 linked a pull request Oct 7, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants