Skip to content

Commit 96bcf71

Browse files
Reorder asserts in TypeBuilderState (#106418)
A newly added System.Reflection.Metadata test does `typeof(Nullable<>).MakeByRefType()`. We: 1. Actually attemt to build a `MethodTable` for this. I guess it's fine to make a `MethodTable` for it. 2. Hit an assert because we're trying to obtain a type loader template for this. Address 2 by reordering asserts so that we never try to look for template types of pointers/byrefs/function pointers.
1 parent c61dc72 commit 96bcf71

File tree

1 file changed

+2
-2
lines changed
  • src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader

1 file changed

+2
-2
lines changed

src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ public LowLevelList<bool> InstanceGCLayout
355355
else
356356
{
357357
Debug.Assert(TypeBeingBuilt.RetrieveRuntimeTypeHandleIfPossible() ||
358-
TypeBeingBuilt.IsTemplateCanonical() ||
359358
(TypeBeingBuilt is PointerType) ||
360359
(TypeBeingBuilt is ByRefType) ||
361-
(TypeBeingBuilt is FunctionPointerType));
360+
(TypeBeingBuilt is FunctionPointerType) ||
361+
TypeBeingBuilt.IsTemplateCanonical());
362362
_instanceGCLayout = s_emptyLayout;
363363
}
364364
}

0 commit comments

Comments
 (0)