-
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
PseudoCustomAttribute.GetStructLayoutCustomAttribute returns incorrect data #12480
Comments
Propose moving to future; not in scope for 3.0 unless someone picks this up. |
Moving to future based on schedule + priority. |
Isn't that will be a breaking change? Also I wonder why it is written this way frist place, tagging @jkotas as he might know more about this code |
The comment explains it: The developer writing this code thought that changing the packing from 0 to 8 is better for some reason. FWIW: This code was checked in on 2003/1/14.
Every bug fix is technically a breaking change. I think it would be fine to delete the adjustment and just return the raw value in metadata. If you are going to fix this, make sure to fix it in all places:
|
This adjustment was trying to minic adjustment performed by type loader, but the logic has been out-of-sync with the type loader evolution for years. It does not make sense for custom attribute reading via reflection to perform this adjustment. Fixes dotnet#12480
This adjustment was trying to minic adjustment performed by type loader, but the logic has been out-of-sync with the type loader evolution for years. It does not make sense for custom attribute reading via reflection to perform this adjustment. Fixes #12480
PseudoCustomAttribute.GetStructLayoutCustomAttribute
currently returns incorrect values for various types. See the implementation here: https://github.com/dotnet/coreclr/blob/72d49127a0c25e4b931c81e621c2411bfb6633a5/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs#L2058-L2096Namely, for the packing it currently changes
0
to8
; but it doesn't take into account any changes that the VM may have made for a given types data.I would expect that this API either return the exact values in metadata or it should return the correct values computed by the VM at runtime.
An example of where this is problematic is for types like
float
it reports8
, when the actual packing is 4. Likewise, forVector128<>
, the packing of 16 is preserved by the VM.Vector<T>
is another case where it currently reportsPack = 8
, butSize = 0
.The text was updated successfully, but these errors were encountered: