From 1fd54b6eb279d8864bd9cf6b7b13c141be4703f0 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Tue, 23 Jul 2024 15:48:48 -0700 Subject: [PATCH] Update assert to handle `object[]` element type (#105287) Co-authored-by: Jan Kotas --- src/coreclr/vm/comutilnative.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coreclr/vm/comutilnative.cpp b/src/coreclr/vm/comutilnative.cpp index 918e66f1145..4f4fda16e3f 100644 --- a/src/coreclr/vm/comutilnative.cpp +++ b/src/coreclr/vm/comutilnative.cpp @@ -433,9 +433,10 @@ extern "C" void QCALLTYPE ExceptionNative_GetMethodFromStackTrace(QCall::ObjectH // The stacktrace can be either sbyte[] or Object[]. In the latter case, // the first entry is the actual stack trace sbyte[], the rest are pointers // to the method info objects. We only care about the first entry here. - if (arrayBaseRef->GetArrayElementType() != ELEMENT_TYPE_I1) + CorElementType elemType = arrayBaseRef->GetArrayElementType(); + if (elemType != ELEMENT_TYPE_I1) { - _ASSERTE(arrayBaseRef->GetArrayElementType() == ELEMENT_TYPE_OBJECT); + _ASSERTE(elemType == ELEMENT_TYPE_CLASS); // object[] PTRARRAYREF ptrArrayRef = (PTRARRAYREF)arrayBaseRef; arrayBaseRef = (ARRAYBASEREF)OBJECTREFToObject(ptrArrayRef->GetAt(0)); }