SergeyTeplyakov/ObjectLayoutInspector

Spn<T>/byref-like types support

controlflow opened this issue · 1 comments

Unfortunately, byref-like types cannot be used as type arguments...

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)

I guess you can emit the "same" type without byref flag...

is UnsafeLayout also fails?