diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index 5249ea70661e0d..a6bf9884a2d138 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -11533,8 +11533,9 @@ VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(__in_z const ch msgStr += W(")"); } #endif - ThrowHR(COR_E_BADIMAGEFORMAT, msgStr); +#else // DACCESS_COMPILE + ThrowHR(COR_E_BADIMAGEFORMAT); #endif // #ifndef DACCESS_COMPILE } diff --git a/src/coreclr/vm/exceptmacros.h b/src/coreclr/vm/exceptmacros.h index 7e3a058f7b2b6b..3fefb7936069a4 100644 --- a/src/coreclr/vm/exceptmacros.h +++ b/src/coreclr/vm/exceptmacros.h @@ -515,8 +515,12 @@ template NOINLINE VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(__in_z const char *cond)) { +#ifdef DACCESS_COMPILE + ThrowBadFormatWorker(resID, nullptr DEBUGARG(cond)); +#else LPCWSTR tmpStr = GetPathForErrorMessagesT(pImgObj); ThrowBadFormatWorker(resID, tmpStr DEBUGARG(cond)); +#endif }