From 9dd676cd3ff67a454dbb02805d935bdaf1ed6bd9 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Sat, 12 Jul 2025 19:17:05 -0700 Subject: [PATCH 1/6] disallow inline arrays with explicit size --- src/coreclr/dlls/mscorrc/mscorrc.rc | 1 + src/coreclr/dlls/mscorrc/resource.h | 2 ++ src/coreclr/vm/methodtablebuilder.cpp | 5 +++++ .../classloader/InlineArray/InlineArrayInvalid.cs | 12 ++++++++++++ .../InlineArray/InlineArrayInvalid.csproj | 1 + .../InlineArray/InvalidCSharpInlineArray.il | 11 +++++++++++ 6 files changed, 32 insertions(+) diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc index e85b88fcdd07aa..0fed12722a1139 100644 --- a/src/coreclr/dlls/mscorrc/mscorrc.rc +++ b/src/coreclr/dlls/mscorrc/mscorrc.rc @@ -308,6 +308,7 @@ BEGIN IDS_CLASSLOAD_INLINE_ARRAY_FIELD_COUNT "InlineArrayAttribute requires that the target type has a single instance field. Type: '%1'. Assembly: '%2'." IDS_CLASSLOAD_INLINE_ARRAY_LENGTH "InlineArrayAttribute requires that the length argument is greater than 0. Type: '%1'. Assembly: '%2'." IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT "InlineArrayAttribute cannot be applied to a type with explicit layout. Type: '%1'. Assembly: '%2'." + IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT_SIZE "InlineArrayAttribute cannot be applied to a type with explicit size. Type: '%1'. Assembly: '%2'." IDS_CLASSLOAD_BYREF_OF_BYREF "Could not create a ByRef of a ByRef. Type: '%1'. Assembly: '%2'." IDS_CLASSLOAD_POINTER_OF_BYREF "Could not create a pointer to a ByRef. Type: '%1'. Assembly: '%2'." diff --git a/src/coreclr/dlls/mscorrc/resource.h b/src/coreclr/dlls/mscorrc/resource.h index 397efa1f2ae768..f7ae1dea4a6259 100644 --- a/src/coreclr/dlls/mscorrc/resource.h +++ b/src/coreclr/dlls/mscorrc/resource.h @@ -160,6 +160,8 @@ #define IDS_CLASSLOAD_BYREF_OF_BYREF 0x17af #define IDS_CLASSLOAD_POINTER_OF_BYREF 0x17b0 +#define IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT_SIZE 0x17b1 + #define IDS_INVALID_REDIM 0x17c3 #define IDS_INVALID_PINVOKE_CALLCONV 0x17c4 #define IDS_CLASSLOAD_NSTRUCT_EXPLICIT_OFFSET 0x17c7 diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp index 66d9199dcfc410..3c6a3446631f43 100644 --- a/src/coreclr/vm/methodtablebuilder.cpp +++ b/src/coreclr/vm/methodtablebuilder.cpp @@ -1793,6 +1793,11 @@ MethodTableBuilder::BuildMethodTableThrowing( { if ((int)bmtFP->NumInstanceFieldBytes != (INT64)bmtFP->NumInstanceFieldBytes) BuildMethodTableThrowException(IDS_CLASSLOAD_FIELDTOOLARGE); + + if (HasExplicitSize() && GetHalfBakedClass()->IsInlineArray()) + { + BuildMethodTableThrowException(IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT_SIZE); + } } if (CheckIfSIMDAndUpdateSize()) diff --git a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs index daa35af75c7502..c6683a18c80ff5 100644 --- a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs +++ b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs @@ -22,6 +22,18 @@ public static void Explicit_Fails() }); } + [Fact] + public static void ExplicitSize_Fails() + { + Console.WriteLine($"{nameof(ExplicitSize_Fails)}..."); + Assert.Throws(() => { var t = typeof(ExplicitSize); }); + + Assert.Throws(() => + { + return sizeof(ExplicitSize); + }); + } + [Fact] public static void ZeroLength_Fails() { diff --git a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.csproj b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.csproj index 098ebbb26a691a..c9e8dc0015fade 100644 --- a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.csproj +++ b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.csproj @@ -5,6 +5,7 @@ true false + 0 diff --git a/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il b/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il index 47e3e0a53d725a..82ef2f12907ee1 100644 --- a/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il +++ b/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il @@ -14,6 +14,17 @@ .field [0] public valuetype [System.Runtime]System.Guid Guid } +.class public sequential ansi sealed beforefieldinit ExplicitSize + extends [System.Runtime]System.ValueType +{ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.InlineArrayAttribute::.ctor(int32) = ( + 01 00 01 00 00 00 00 00 + ) + + .size 256 + .field [0] public valuetype [System.Runtime]System.Guid Guid +} + .class public sequential ansi sealed beforefieldinit ZeroLength extends [System.Runtime]System.ValueType { From a017f9854dc7ba7691669373c97920ce9b061f9b Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Sat, 12 Jul 2025 21:54:18 -0700 Subject: [PATCH 2/6] change for mono --- src/mono/mono/metadata/class-init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mono/mono/metadata/class-init.c b/src/mono/mono/metadata/class-init.c index 6b8daf900f7494..fd0dd1c76ec829 100644 --- a/src/mono/mono/metadata/class-init.c +++ b/src/mono/mono/metadata/class-init.c @@ -317,6 +317,13 @@ mono_class_setup_fields (MonoClass *klass) if (explicit_size) instance_size += real_size; + if (explicit_size && m_class_is_inlinearray (klass)) { + if (mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback) + mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback (klass, "Inline array must not have explicit size."); + else + mono_class_set_type_load_failure (klass, "Inline array must not have explicit size."); + } + /* * This function can recursively call itself. * Prevent infinite recursion by using a list in TLS. From 53f5c2f3a83eaa5a4c786a4b5273361f3c4ab941 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Sun, 13 Jul 2025 14:22:47 -0700 Subject: [PATCH 3/6] change for the Native AOT --- .../src/Internal/Runtime/TypeLoaderExceptionHelper.cs | 2 ++ .../tools/Common/TypeSystem/Common/ExceptionStringID.cs | 1 + .../TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs | 6 ++++++ .../Common/TypeSystem/Common/Properties/Resources.resx | 3 +++ src/coreclr/vm/methodtablebuilder.cpp | 4 +++- .../System.Private.CoreLib/src/Resources/Strings.resx | 3 +++ src/mono/mono/metadata/class-init.c | 2 +- 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs index 70d17bb96989d7..e837f7c6c96518 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs @@ -92,6 +92,8 @@ private static string GetFormatString(ExceptionStringID id) return SR.ClassLoad_InlineArrayLength; case ExceptionStringID.ClassLoadInlineArrayExplicit: return SR.ClassLoad_InlineArrayExplicit; + case ExceptionStringID.ClassLoadInlineArrayExplicitSize: + return SR.ClassLoad_InlineArrayExplicitSize; case ExceptionStringID.InvalidProgramDefault: return SR.InvalidProgram_Default; case ExceptionStringID.InvalidProgramSpecific: diff --git a/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs b/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs index 923ec0da4316fb..97363c783f8a3e 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs @@ -19,6 +19,7 @@ public enum ExceptionStringID ClassLoadInlineArrayFieldCount, ClassLoadInlineArrayLength, ClassLoadInlineArrayExplicit, + ClassLoadInlineArrayExplicitSize, // MissingMethodException MissingMethod, diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs index 107d8dbffb87c4..4b79f5fbde0f80 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs @@ -473,6 +473,12 @@ protected ComputedInstanceFieldLayout ComputeSequentialFieldLayout(MetadataType if (type.IsInlineArray) { + // inline array cannot have explicit instance size + if (layoutMetadata.Size != 0) + { + ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadInlineArrayExplicitSize, type); + } + AdjustForInlineArray(type, numInstanceFields, ref instanceByteSizeAndAlignment, ref instanceSizeAndAlignment); } diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx b/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx index 6a2f012e012586..1ce5dcbd5e3333 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx +++ b/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx @@ -138,6 +138,9 @@ InlineArrayAttribute cannot be applied to a type with explicit layout. Type: '{0}'. Assembly: '{1}'.' + + InlineArrayAttribute cannot be applied to a type with explicit size. Type: '{0}'. Assembly: '{1}'.' + Array of type '{0}' from assembly '{1}' cannot be created because base value type is too large diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp index 3c6a3446631f43..040fc60c7d18b5 100644 --- a/src/coreclr/vm/methodtablebuilder.cpp +++ b/src/coreclr/vm/methodtablebuilder.cpp @@ -1794,7 +1794,9 @@ MethodTableBuilder::BuildMethodTableThrowing( if ((int)bmtFP->NumInstanceFieldBytes != (INT64)bmtFP->NumInstanceFieldBytes) BuildMethodTableThrowException(IDS_CLASSLOAD_FIELDTOOLARGE); - if (HasExplicitSize() && GetHalfBakedClass()->IsInlineArray()) + if (HasExplicitSize() && + bmtLayout->layoutType == EEClassLayoutInfo::LayoutType::Sequential && + GetHalfBakedClass()->IsInlineArray()) { BuildMethodTableThrowException(IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT_SIZE); } diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index 4b45d710bc3fd6..497a524ed303fa 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -4202,6 +4202,9 @@ InlineArrayAttribute cannot be applied to a type with explicit layout. Type: '{0}'. Assembly: '{1}'. + + InlineArrayAttribute cannot be applied to a type with explicit size. Type: '{0}'. Assembly: '{1}'. + Could not load type '{0}' from assembly '{1}' because generic types cannot have explicit layout. diff --git a/src/mono/mono/metadata/class-init.c b/src/mono/mono/metadata/class-init.c index fd0dd1c76ec829..a5f299227b5358 100644 --- a/src/mono/mono/metadata/class-init.c +++ b/src/mono/mono/metadata/class-init.c @@ -317,7 +317,7 @@ mono_class_setup_fields (MonoClass *klass) if (explicit_size) instance_size += real_size; - if (explicit_size && m_class_is_inlinearray (klass)) { + if (explicit_size && layout == TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT && m_class_is_inlinearray (klass)) { if (mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback) mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback (klass, "Inline array must not have explicit size."); else From c3fc83fc938f4791bc038a889536855172d0dce7 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Mon, 14 Jul 2025 08:59:08 -0700 Subject: [PATCH 4/6] ignore size for auto layout --- .../classloader/InlineArray/InlineArrayInvalid.cs | 4 ++++ .../InlineArray/InvalidCSharpInlineArray.il | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs index c6683a18c80ff5..563628ffe75b6c 100644 --- a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs +++ b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs @@ -26,6 +26,10 @@ public static void Explicit_Fails() public static void ExplicitSize_Fails() { Console.WriteLine($"{nameof(ExplicitSize_Fails)}..."); + + // .size is ignored for auto layout + Assert.Equal(true, sizeof(ExplicitSizeAuto) > 0); + Assert.Throws(() => { var t = typeof(ExplicitSize); }); Assert.Throws(() => diff --git a/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il b/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il index 82ef2f12907ee1..059a9d889fe716 100644 --- a/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il +++ b/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il @@ -25,6 +25,17 @@ .field [0] public valuetype [System.Runtime]System.Guid Guid } +.class public auto ansi sealed beforefieldinit ExplicitSizeAuto + extends [System.Runtime]System.ValueType +{ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.InlineArrayAttribute::.ctor(int32) = ( + 01 00 01 00 00 00 00 00 + ) + + .size 256 + .field [0] public valuetype [System.Runtime]System.Guid Guid +} + .class public sequential ansi sealed beforefieldinit ZeroLength extends [System.Runtime]System.ValueType { From 61ca2c0a359428f23ee8a31d2f63881ac0d6d346 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Mon, 14 Jul 2025 11:57:55 -0700 Subject: [PATCH 5/6] use Assert.True --- src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs index 563628ffe75b6c..8caf29fec65cbc 100644 --- a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs +++ b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs @@ -28,7 +28,7 @@ public static void ExplicitSize_Fails() Console.WriteLine($"{nameof(ExplicitSize_Fails)}..."); // .size is ignored for auto layout - Assert.Equal(true, sizeof(ExplicitSizeAuto) > 0); + Assert.True(sizeof(ExplicitSizeAuto) > 0); Assert.Throws(() => { var t = typeof(ExplicitSize); }); From 474fa509b9699b17071b215580198a5770489414 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 16 Jul 2025 13:45:21 -0700 Subject: [PATCH 6/6] check in Auto as well, including generic structs --- .../Common/MetadataFieldLayoutAlgorithm.cs | 12 +++---- src/coreclr/vm/methodtablebuilder.cpp | 13 ++++--- src/mono/mono/metadata/class-init.c | 2 +- .../InlineArray/InlineArrayInvalid.cs | 35 +++++++++++++++---- .../InlineArray/InvalidCSharpInlineArray.il | 11 ++++++ 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs index 4b79f5fbde0f80..604f76cd09442f 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs @@ -473,12 +473,6 @@ protected ComputedInstanceFieldLayout ComputeSequentialFieldLayout(MetadataType if (type.IsInlineArray) { - // inline array cannot have explicit instance size - if (layoutMetadata.Size != 0) - { - ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadInlineArrayExplicitSize, type); - } - AdjustForInlineArray(type, numInstanceFields, ref instanceByteSizeAndAlignment, ref instanceSizeAndAlignment); } @@ -516,6 +510,12 @@ private static void AdjustForInlineArray( ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadInlineArrayFieldCount, type); } + var layoutMetadata = type.GetClassLayout(); + if (layoutMetadata.Size != 0) + { + ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadInlineArrayExplicitSize, type); + } + if (!instanceByteSizeAndAlignment.Size.IsIndeterminate) { long size = instanceByteSizeAndAlignment.Size.AsInt; diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp index 040fc60c7d18b5..f8628b4197edc3 100644 --- a/src/coreclr/vm/methodtablebuilder.cpp +++ b/src/coreclr/vm/methodtablebuilder.cpp @@ -1771,6 +1771,12 @@ MethodTableBuilder::BuildMethodTableThrowing( { BuildMethodTableThrowException(IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT); } + + ULONG classSize; + if (SUCCEEDED(GetMDImport()->GetClassTotalSize(cl, &classSize)) && classSize != 0) + { + BuildMethodTableThrowException(IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT_SIZE); + } } } } @@ -1793,13 +1799,6 @@ MethodTableBuilder::BuildMethodTableThrowing( { if ((int)bmtFP->NumInstanceFieldBytes != (INT64)bmtFP->NumInstanceFieldBytes) BuildMethodTableThrowException(IDS_CLASSLOAD_FIELDTOOLARGE); - - if (HasExplicitSize() && - bmtLayout->layoutType == EEClassLayoutInfo::LayoutType::Sequential && - GetHalfBakedClass()->IsInlineArray()) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_INLINE_ARRAY_EXPLICIT_SIZE); - } } if (CheckIfSIMDAndUpdateSize()) diff --git a/src/mono/mono/metadata/class-init.c b/src/mono/mono/metadata/class-init.c index a5f299227b5358..52f108fc7cc9a0 100644 --- a/src/mono/mono/metadata/class-init.c +++ b/src/mono/mono/metadata/class-init.c @@ -317,7 +317,7 @@ mono_class_setup_fields (MonoClass *klass) if (explicit_size) instance_size += real_size; - if (explicit_size && layout == TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT && m_class_is_inlinearray (klass)) { + if (explicit_size && real_size != 0 && m_class_is_inlinearray (klass)) { if (mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback) mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback (klass, "Inline array must not have explicit size."); else diff --git a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs index 8caf29fec65cbc..0171c97429de56 100644 --- a/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs +++ b/src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs @@ -23,18 +23,41 @@ public static void Explicit_Fails() } [Fact] - public static void ExplicitSize_Fails() + public static void ExplicitSize_FailsInSequential() { - Console.WriteLine($"{nameof(ExplicitSize_Fails)}..."); - - // .size is ignored for auto layout - Assert.True(sizeof(ExplicitSizeAuto) > 0); + Console.WriteLine($"{nameof(ExplicitSize_FailsInSequential)}..."); Assert.Throws(() => { var t = typeof(ExplicitSize); }); Assert.Throws(() => { - return sizeof(ExplicitSize); + return new ExplicitSize(); + }); + } + + [Fact] + public static void ExplicitSize_FailsInAuto() + { + Console.WriteLine($"{nameof(ExplicitSize_FailsInAuto)}..."); + + Assert.Throws(() => { var t = typeof(ExplicitSizeAuto); }); + + Assert.Throws(() => + { + return sizeof(ExplicitSizeAuto); + }); + } + + [Fact] + public static void ExplicitSize_FailsInGeneric() + { + Console.WriteLine($"{nameof(ExplicitSize_FailsInGeneric)}..."); + + Assert.Throws(() => { var t = typeof(ExplicitSizeGeneric); }); + + Assert.Throws(() => + { + return new ExplicitSizeGeneric(); }); } diff --git a/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il b/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il index 059a9d889fe716..ca71640f41fc37 100644 --- a/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il +++ b/src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il @@ -36,6 +36,17 @@ .field [0] public valuetype [System.Runtime]System.Guid Guid } +.class public auto ansi sealed beforefieldinit ExplicitSizeGeneric`1 + extends [System.Runtime]System.ValueType +{ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.InlineArrayAttribute::.ctor(int32) = ( + 01 00 01 00 00 00 00 00 + ) + + .size 256 + .field [0] public valuetype [System.Runtime]System.Guid Guid +} + .class public sequential ansi sealed beforefieldinit ZeroLength extends [System.Runtime]System.ValueType {