Contract violation in generating exception is benign, it can be ignored (#40220)
authorDavid Wrighton <davidwr@microsoft.com>
Sat, 1 Aug 2020 03:47:39 +0000 (20:47 -0700)
committerGitHub <noreply@github.com>
Sat, 1 Aug 2020 03:47:39 +0000 (20:47 -0700)
src/coreclr/src/vm/class.cpp

index 7a243ca..d56cb02 100644 (file)
@@ -1228,10 +1228,12 @@ void ClassLoader::ValidateMethodsWithCovariantReturnTypes(MethodTable* pMT)
                 TypeString::AppendType(strInvalidTypeName, TypeHandle(pMD->GetMethodTable()));
 
                 SString strInvalidMethodName;
-                TypeString::AppendMethod(strInvalidMethodName, pMD, pMD->GetMethodInstantiation());
-
                 SString strParentMethodName;
-                TypeString::AppendMethod(strParentMethodName, pParentMD, pParentMD->GetMethodInstantiation());
+                {
+                    CONTRACT_VIOLATION(LoadsTypeViolation);
+                    TypeString::AppendMethod(strInvalidMethodName, pMD, pMD->GetMethodInstantiation());
+                    TypeString::AppendMethod(strParentMethodName, pParentMD, pParentMD->GetMethodInstantiation());
+                }
 
                 COMPlusThrow(
                     kTypeLoadException,