see explanation and possible fix here...
I think this may be the same as the bug submitted for SetData()...
Yes that's a bug. Thanks for the heads up!
Casting to IntPtr in SetData will only work for IntPtrs. These functions must work with all blittable complex types as well.
If you use the PinnedHandle class from the repo in Helper.cs it should be fixed:
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).