Skip to content

Conversation

andreakarasho
Copy link

No description provided.

@BasGeertsema
Copy link

I noticed the warning in the documentation. It seems to me that we actually want the size of the unmanaged view of the type? In that case we would need to use Marshal.SizeOf, as it is now.

@andreakarasho
Copy link
Author

Partially reverted to the Marshalversion but keeping the constraint version.

@jsturtevant
Copy link
Contributor

Should we try using the internal structs version before updating this? #332 (comment)

I think using the internal structs would remove the need for this change

@BasGeertsema
Copy link

Should we try using the internal structs version before updating this? #332 (comment)

I think using the internal structs would remove the need for this change

I agree, that would be a better solution.

@andreakarasho
Copy link
Author

Closing this because seems to be necessary anymore.


Side note:

I noticed the warning in the documentation. It seems to me that we actually want the size of the unmanaged view of the type? In that case we would need to use Marshal.SizeOf, as it is now.

Seems like they updated the documentation and removed that warning (?). MS now suggets to use sizeof (Unsafe.SizeOf is just a wrapper around sizeof) for blittable structs (which this was the case).
https://learn.microsoft.com/en-us/dotnet/standard/native-interop/best-practices#structs

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 this pull request may close these issues.

3 participants