ObjectLayoutInspector
ObjectLayoutInspector copied to clipboard
Issue when examining ref structs
Have to use the Type
overload as they can't be used as a generic parameter; however fails due to MakeGenericType
I assume for same reason?
Unhandled Exception: System.TypeLoadException: The generic type 'SizeComputer`1' was used with an invalid instantiation in assembly 'ObjectLayoutInspector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at System.RuntimeType.MakeGenericType(Type[] instantiation)
at ObjectLayoutInspector.InspectorHelper.GetSizeOfValueTypeInstance(Type type)
at ObjectLayoutInspector.InspectorHelper.GetSize(Type type)
at ObjectLayoutInspector.TypeLayout.<GetLayout>g__DoGetLayout|24_0(<>c__DisplayClass24_0& )
at ObjectLayoutInspector.TypeLayout.GetLayout(Type type, TypeLayoutCache cache, Boolean includePaddings)
Hey, @benaadams , sorry for the late reply, I completely missed this bug.
It seems that MakeGenericType
just "works" on .NET Framework for ref structs, but fails on .NET Core.
I'm not sure what can I do here, unfortunately, besides failing with more appropriate error message.
I'll think about other approaches though...