Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Remove empty lines caused by empty fusion log string (#27471)
Browse files Browse the repository at this point in the history
* Remove empty lines caused by empty fusion log string

* Remove fusion log more
  • Loading branch information
danmoseley authored and msftbot[bot] committed Oct 27, 2019
1 parent b64c201 commit 7cdde63
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ namespace System
public partial class BadImageFormatException
{
// Do not delete: this is invoked from native code.
private BadImageFormatException(string? fileName, string? fusionLog, int hResult)
private BadImageFormatException(string? fileName, int hResult)
: base(null)
{
HResult = hResult;
_fileName = fileName;
_fusionLog = fusionLog;
SetMessageField();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ namespace System.IO
public partial class FileLoadException
{
// Do not delete: this is invoked from native code.
private FileLoadException(string? fileName, string? fusionLog, int hResult)
private FileLoadException(string? fileName, int hResult)
: base(null)
{
HResult = hResult;
FileName = fileName;
FusionLog = fusionLog;
_message = FormatFileLoadExceptionMessage(FileName, HResult);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ namespace System.IO
public partial class FileNotFoundException
{
// Do not delete: this is invoked from native code.
private FileNotFoundException(string? fileName, string? fusionLog, int hResult)
private FileNotFoundException(string? fileName, int hResult)
: base(null)
{
HResult = hResult;
FileName = fileName;
FusionLog = fusionLog;
SetMessageField();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3801,7 +3801,7 @@ DomainAssembly* AppDomain::LoadDomainAssembly(AssemblySpec* pSpec,
{
StackSString name;
pSpec->GetFileOrDisplayName(0, name);
pEx=new EEFileLoadException(name, pEx->GetHR(), NULL, pEx);
pEx=new EEFileLoadException(name, pEx->GetHR(), pEx);
AddExceptionToCache(pSpec, pEx);
PAL_CPP_THROW(Exception *, pEx);
}
Expand Down
10 changes: 2 additions & 8 deletions src/vm/clrex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,10 +1675,9 @@ OBJECTREF EETypeLoadException::CreateThrowable()
// EEFileLoadException is an EE exception subclass representing a file loading
// error
// ---------------------------------------------------------------------------
EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, void *pFusionLog, Exception *pInnerException/* = NULL*/)
EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, Exception *pInnerException/* = NULL*/)
: EEException(GetFileLoadKind(hr)),
m_name(name),
m_pFusionLog(pFusionLog),
m_hr(hr)
{
CONTRACTL
Expand Down Expand Up @@ -1822,22 +1821,18 @@ OBJECTREF EEFileLoadException::CreateThrowable()
}
CONTRACTL_END;

// Fetch any log info from the fusion log
SString logText;
struct _gc {
OBJECTREF pNewException;
STRINGREF pNewFileString;
STRINGREF pFusLogString;
} gc;
ZeroMemory(&gc, sizeof(gc));
GCPROTECT_BEGIN(gc);

gc.pNewFileString = StringObject::NewString(m_name);
gc.pFusLogString = StringObject::NewString(logText);
gc.pNewException = AllocateObject(MscorlibBinder::GetException(m_kind));

MethodDesc* pMD = MemberLoader::FindMethod(gc.pNewException->GetMethodTable(),
COR_CTOR_METHOD_NAME, &gsig_IM_Str_Str_Int_RetVoid);
COR_CTOR_METHOD_NAME, &gsig_IM_Str_Int_RetVoid);

if (!pMD)
{
Expand All @@ -1850,7 +1845,6 @@ OBJECTREF EEFileLoadException::CreateThrowable()
ARG_SLOT args[] = {
ObjToArgSlot(gc.pNewException),
ObjToArgSlot(gc.pNewFileString),
ObjToArgSlot(gc.pFusLogString),
(ARG_SLOT) m_hr
};

Expand Down
8 changes: 3 additions & 5 deletions src/vm/clrex.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,13 +668,11 @@ class EEFileLoadException : public EEException

private:
SString m_name;
void *m_pFusionLog;
HRESULT m_hr;


public:

EEFileLoadException(const SString &name, HRESULT hr, void *pFusionLog = NULL, Exception *pInnerException = NULL);
EEFileLoadException(const SString &name, HRESULT hr, Exception *pInnerException = NULL);
~EEFileLoadException();

// virtual overrides
Expand All @@ -698,12 +696,12 @@ class EEFileLoadException : public EEException
virtual Exception *CloneHelper()
{
WRAPPER_NO_CONTRACT;
return new EEFileLoadException(m_name, m_hr, m_pFusionLog);
return new EEFileLoadException(m_name, m_hr);
}

private:
#ifdef _DEBUG
EEFileLoadException() : m_pFusionLog(NULL)
EEFileLoadException()
{
// Used only for DebugIsEECxxExceptionPointer to get the vtable pointer.
// We need a variant which does not allocate memory.
Expand Down

0 comments on commit 7cdde63

Please sign in to comment.