Skip to content

Commit 1596431

Browse files
Copilotagocke
andcommitted
Add pSpec parameter to CreateVersionConflictException for future version info enhancement
Co-authored-by: agocke <[email protected]>
1 parent bad6db7 commit 1596431

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/coreclr/vm/clrex.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,21 +1669,21 @@ BOOL EEFileLoadException::CheckType(Exception* ex)
16691669

16701670
// Helper method to create a FileLoadException with custom message for version conflicts
16711671
/* static */
1672-
EEFileLoadException* EEFileLoadException::CreateVersionConflictException(const SString &name, Exception *pInnerException)
1672+
EEFileLoadException* EEFileLoadException::CreateVersionConflictException(const SString &name, Exception *pInnerException, AssemblySpec *pSpec)
16731673
{
16741674
// Create exception with FUSION_E_REF_DEF_MISMATCH to maintain backward compatibility
16751675
// (existing code checks for this HRESULT, e.g., Marshal.cs)
16761676
EEFileLoadException *pException = new EEFileLoadException(name, FUSION_E_REF_DEF_MISMATCH, pInnerException);
16771677

1678-
// Use FUSION_E_APP_DOMAIN_LOCKED's message which specifically describes version conflicts:
1679-
// "The requested assembly version conflicts with what is already bound..."
1680-
// This provides a clearer error than FUSION_E_REF_DEF_MISMATCH's generic message.
1678+
// Build custom message with version conflict details
1679+
// The name parameter already includes the full requested assembly identity with version
16811680
StackSString formatString;
16821681
formatString.LoadResource(IDS_EE_FILELOAD_ERROR_GENERIC);
16831682
StackSString versionMessage;
16841683
GetHRMsg(FUSION_E_APP_DOMAIN_LOCKED, versionMessage);
16851684
StackSString customMessage;
16861685
customMessage.FormatMessage(FORMAT_MESSAGE_FROM_STRING, formatString.GetUnicode(), 0, 0, name, versionMessage);
1686+
16871687
pException->m_customMessage.Set(customMessage);
16881688

16891689
return pException;
@@ -1718,7 +1718,7 @@ void DECLSPEC_NORETURN EEFileLoadException::Throw(AssemblySpec *pSpec, HRESULT
17181718
// message to provide clearer information about version conflicts.
17191719
if (hr == FUSION_E_APP_DOMAIN_LOCKED)
17201720
{
1721-
EEFileLoadException *pException = CreateVersionConflictException(name, pInnerException);
1721+
EEFileLoadException *pException = CreateVersionConflictException(name, pInnerException, pSpec);
17221722
PAL_CPP_THROW(EEFileLoadException *, pException);
17231723
}
17241724

src/coreclr/vm/clrex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ class EEFileLoadException : public EEException
694694
}
695695

696696
// Helper method to create exception with custom message for version conflicts
697-
static EEFileLoadException* CreateVersionConflictException(const SString &name, Exception *pInnerException);
697+
static EEFileLoadException* CreateVersionConflictException(const SString &name, Exception *pInnerException, AssemblySpec *pSpec = NULL);
698698

699699
private:
700700
#ifdef _DEBUG

0 commit comments

Comments
 (0)