You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DefineUninitializedData on TypeBuilder in System.Reflection.Emit uses typeof(ValueType) internally, even when using a MetadataLoadContext.
This causes type.IsValueType to return false even though it is true, which causes invalid IL to be emitted (fields are being marked class when they should be marked valuetype, causing failures to load)
Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.
TrueLunacy
changed the title
DefineInitializedData on TypeBuilder in System.Reflection.Emit uses typeof(ValueType) internally even when using a MetadataLoadContext
DefineUninitializedData on TypeBuilder in System.Reflection.Emit uses typeof(ValueType) internally even when using a MetadataLoadContext
Jul 31, 2024
Description
DefineUninitializedData on TypeBuilder in System.Reflection.Emit uses typeof(ValueType) internally, even when using a MetadataLoadContext.
This causes type.IsValueType to return false even though it is true, which causes invalid IL to be emitted (fields are being marked
class
when they should be markedvaluetype
, causing failures to load)Reproduction Steps
Expected behavior
type.IsValueType should return true.
type == typeof(ValueType) should return false.
type == contextValueType should return true.
Actual behavior
type.IsValueType returns false.
type == typeof(ValueType) returns true.
type == contextValueType returns false.
Regression?
Unknown
Known Workarounds
No response
Configuration
Arch Linux x64, dotnet 9.0.100-rc.1.24381.3
Other information
As far as I can tell, this appears to be because DefineDataHelper in TypeBuilderImpl.cs uses typeof(ValueType) to define its helper type.
The text was updated successfully, but these errors were encountered: