Skip to content

Commit 6bf83a1

Browse files
committed
Use do-while loop to include System.Object attributes
Signed-off-by: Medha Tiwari <[email protected]>
1 parent 98554b6 commit 6bf83a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,12 +1270,12 @@ internal static object[] GetCustomAttributes(RuntimeType type, RuntimeType caTyp
12701270
for (int i = 0; i < pcas.Count; i++)
12711271
result.Add(pcas[i]);
12721272

1273-
while (type != null)
1273+
do
12741274
{
12751275
AddCustomAttributes(ref result, type.GetRuntimeModule(), type.MetadataToken, caType, mustBeInheritable, result);
12761276
mustBeInheritable = true;
12771277
type = (type.BaseType as RuntimeType)!;
1278-
}
1278+
} while (type != (RuntimeType)typeof(object) && type != null);
12791279

12801280
object[] typedResult = CreateAttributeArrayHelper(caType, result.Count);
12811281
for (int i = 0; i < result.Count; i++)

0 commit comments

Comments
 (0)