-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
(non)Blittable data #26381
Comments
That is indeed similar, but in this case I'm specifying the layout, isn't it correct? |
It's the array that is an object reference. You could perhaps change it to two fields public ws2811_channel_t channel_0;
public ws2811_channel_t channel_1; |
Mono does not enforce the restrictions on pinned GCHandle objects. It is |
@0xd4d changing that to two fields would break on the C code here for example, wouldn't it? Since it's iterating an array |
Nevermind, after testing I've found out that it works. Thank you very much! |
First of all I'm not quite familiar with marshalling and dealing with unmanaged resources.
I was migrating a project that was compiled and ran with mono and Framework v4.6.1. Basically what I had to do was only change the target framework, yet one thing that made everything stop working was trying to Pin an object into memory with
GCHandle.Alloc
. That threw an exception stating thatUnhandled Exception: System.ArgumentException: Object contains non-primitive or non-blittable data.
What I find weird is that this allegedly (I take the word of the owner when he says that it runs successfully) this works when running with Mono. is there any difference on how .NET core and Mono treat memory ?
I'll leave the links for the object I'm pining, as well as the line where the exception is thrown.
Line where exception is thrown
Object that I'm trying to pin
I've looked on both mono Blittable types and dotnet blittable Types but I'm not familiar with that
Is this a possible bug, or simply misunderstanding on my part?
The text was updated successfully, but these errors were encountered: