Fix the compilation error (#56889)
authorKunal Pathak <Kunal.Pathak@microsoft.com>
Thu, 5 Aug 2021 11:20:17 +0000 (04:20 -0700)
committerGitHub <noreply@github.com>
Thu, 5 Aug 2021 11:20:17 +0000 (13:20 +0200)
src/coreclr/tools/Common/TypeSystem/Common/ExplicitLayoutValidator.cs

index 07489f8..715afb9 100644 (file)
@@ -53,7 +53,7 @@ namespace Internal.TypeSystem
 
         // Represent field layout bits as as a series of intervals to prevent pathological bad behavior
         // involving excessively large explicit layout structures.
-        private readonly List<FieldLayoutInterval> _fieldLayout = new List<FieldLayoutInterval>();
+        private readonly List<FieldLayoutInterval> _fieldLayout;
 
         private readonly MetadataType _typeBeingValidated;
 
@@ -61,6 +61,7 @@ namespace Internal.TypeSystem
         {
             _typeBeingValidated = type;
             _pointerSize = type.Context.Target.PointerSize;
+            _fieldLayout = new List<FieldLayoutInterval>();
         }
 
         public static void Validate(MetadataType type, ComputedInstanceFieldLayout layout)