pTemplateEEType = templateTypeHandle.ToEETypePtr();
}
- else if (type.IsMdArray || (type.IsSzArray && ((ArrayType)type).ElementType.IsPointer))
- {
- // Multidimensional arrays and szarrays of pointers don't implement generic interfaces and
- // we don't need to do much for them in terms of type building. We can pretty much just take
- // the MethodTable for any of those, massage the bits that matter (GCDesc, element type,
- // component size,...) to be of the right shape and we're done.
- pTemplateEEType = typeof(object[,]).TypeHandle.ToEETypePtr();
- }
else
{
Debug.Assert(state.TemplateType != null && !state.TemplateType.RuntimeTypeHandle.IsNull());
{
if (!_templateComputed)
{
- // Multidimensional arrays and szarrays of pointers don't implement generic interfaces and are special cases. They use
+ // Multidimensional arrays don't implement generic interfaces and are special cases. They use
// typeof(object[,]) as their template.
- if (TypeBeingBuilt.IsMdArray || (TypeBeingBuilt.IsSzArray && ((ArrayType)TypeBeingBuilt).ElementType.IsPointer))
+ if (TypeBeingBuilt.IsMdArray)
{
_templateType = TypeBeingBuilt.Context.ResolveRuntimeTypeHandle(typeof(object[,]).TypeHandle);
_templateTypeLoaderNativeLayout = false;
return _templateType;
}
+ // Arrays of pointers don't implement generic interfaces and are special cases. They use
+ // typeof(char*[]) as their template.
+ if (TypeBeingBuilt.IsSzArray && ((ArrayType)TypeBeingBuilt).ElementType.IsPointer)
+ {
+ _templateType = TypeBeingBuilt.Context.ResolveRuntimeTypeHandle(typeof(char*[]).TypeHandle);
+ _templateTypeLoaderNativeLayout = false;
+ _nativeLayoutComputed = _nativeLayoutTokenComputed = _templateComputed = true;
+
+ return _templateType;
+ }
+
// Locate the template type and native layout info
_templateType = TemplateLocator.TryGetTypeTemplate(TypeBeingBuilt, ref _nativeLayoutInfo);
Debug.Assert(_templateType == null || !_templateType.RuntimeTypeHandle.IsNull());