-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Replace use of Marshal.SizeOf
with sizeof
for blittable structs
#3218
Comments
Thank you @vatsan-madhavan, we're aware of this, and we've been making these changes as we go through our codebase. |
Note that WinForms has had regressions when switching from In particular code from linked comment detailing the difference
|
Makes sense. In practice correct use of bool would look like |
BTW https://docs.microsoft.com/en-us/dotnet/framework/interop/blittable-and-non-blittable-types calls out I believe they both work with
Very similar arguments apply to structs with |
Yes bool/char is non-blittable but works anyways, it was specifically enabled here: dotnet/runtime#13772 (issue) and dotnet/runtime#1866 (PR). The runtime uses different size/alignment for |
dotnet/pinvoke#463 (comment)
There are many uses of
Marshal.SizeOf
in the codebase - many of them likely for blittable types - that could be identified and updated to use fastersizeof
./cc @dotnet/dotnet-winforms - This probably applies to Winforms as well.
The text was updated successfully, but these errors were encountered: