* Fix crossgen2 to fix some negative tests
This change fixes 4 negative tests in the Loader\classloader\generics\Instantiation\Negative
folder.
The tests were trying to instantiate objects using generic definition types
without supplying generic arguments.
public override ComputedInstanceFieldLayout ComputeInstanceLayout(DefType defType, InstanceLayoutKind layoutKind)
{
MetadataType type = (MetadataType)defType;
+
+ if (type.IsGenericDefinition)
+ {
+ ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, type);
+ }
+
// CLI - Partition 1, section 9.5 - Generic types shall not be marked explicitlayout.
if (type.HasInstantiation && type.IsExplicitLayout)
{
originalMethod = HandleToObject(pResolvedToken.hMethod);
TypeDesc type = HandleToObject(pResolvedToken.hClass);
+ if (type.IsGenericDefinition)
+ {
+ ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramSpecific, HandleToObject(callerHandle));
+ }
+
// This formula roughly corresponds to CoreCLR CEEInfo::resolveToken when calling GetMethodDescFromMethodSpec
// (that always winds up by calling FindOrCreateAssociatedMethodDesc) at
// https://github.com/dotnet/coreclr/blob/57a6eb69b3d6005962ad2ae48db18dff268aff56/src/vm/jitinterface.cpp#L1141