Skip to content

Commit 96228a0

Browse files
elinor-fungCopilot
andcommitted
Simplify EEFileLoadException: delegating ctor and throw site
- Make the diagnosticInfo constructor delegate to the base constructor instead of duplicating its body. - Remove the unnecessary IsEmpty check at the throw site in AppDomain::BindAssemblySpec — always pass bindDiagnosticInfo since CreateThrowable already gates on m_diagnosticInfo.IsEmpty(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7976c56 commit 96228a0

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

src/coreclr/vm/appdomain.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3193,11 +3193,7 @@ PEAssembly * AppDomain::BindAssemblySpec(
31933193

31943194
if (fFailure && fThrowOnFileNotFound)
31953195
{
3196-
if (!bindDiagnosticInfo.IsEmpty())
3197-
{
3198-
EEFileLoadException::Throw(pFailedSpec, COR_E_FILENOTFOUND, bindDiagnosticInfo, NULL);
3199-
}
3200-
EEFileLoadException::Throw(pFailedSpec, COR_E_FILENOTFOUND, NULL);
3196+
EEFileLoadException::Throw(pFailedSpec, COR_E_FILENOTFOUND, bindDiagnosticInfo, NULL);
32013197
}
32023198
}
32033199
}

src/coreclr/vm/clrex.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,10 +1453,7 @@ EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, Except
14531453

14541454

14551455
EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, const SString &diagnosticInfo, Exception *pInnerException/* = NULL*/)
1456-
: EEException(GetFileLoadKind(hr)),
1457-
m_name(name),
1458-
m_hr(hr),
1459-
m_diagnosticInfo(diagnosticInfo)
1456+
: EEFileLoadException(name, hr, pInnerException)
14601457
{
14611458
CONTRACTL
14621459
{
@@ -1466,11 +1463,7 @@ EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, const
14661463
}
14671464
CONTRACTL_END;
14681465

1469-
_ASSERTE(pInnerException == NULL || !(pInnerException->IsTransient()));
1470-
m_innerException = pInnerException ? pInnerException->DomainBoundClone() : NULL;
1471-
1472-
if (m_name.IsEmpty())
1473-
m_name.Set(W("<Unknown>"));
1466+
m_diagnosticInfo.Set(diagnosticInfo);
14741467
}
14751468

14761469

0 commit comments

Comments
 (0)