Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some dead code that threw file load exception #87290

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/coreclr/dlls/mscorrc/mscorrc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ BEGIN
FUSION_E_REF_DEF_MISMATCH "The located assembly's manifest definition with name '%1' does not match the assembly reference."
FUSION_E_PRIVATE_ASM_DISALLOWED "Assembly '%1' is required to be strongly named."
FUSION_E_INVALID_NAME "The given assembly name, '%1', was invalid."
FUSION_E_CACHEFILE_FAILED "Failed to add file to AppDomain cache."
FUSION_E_APP_DOMAIN_LOCKED "The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest."
IDS_EE_HASH_VAL_FAILED "Hash validation failed for file or assembly '%1'."
CORSEC_E_INVALID_PUBLICKEY "The public key for assembly '%1' was invalid."
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/inc/corerror.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@
<Comment> The given assembly name was invalid. </Comment>
</HRESULT>

<HRESULT NumericValue="0x80131052">
<SymbolicName>FUSION_E_CACHEFILE_FAILED</SymbolicName>
<Message>"Failed to add file to AppDomain cache."</Message>
<Comment> Failed to add file to AppDomain cache </Comment>
</HRESULT>

<HRESULT NumericValue="0x80131053">
<SymbolicName>FUSION_E_APP_DOMAIN_LOCKED</SymbolicName>
<Message>"The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest."</Message>
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/pal/prebuilt/corerror/mscorurt.rc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ BEGIN
MSG_FOR_URT_HR(FUSION_E_REF_DEF_MISMATCH) "The located assembly's manifest definition does not match the assembly reference."
MSG_FOR_URT_HR(FUSION_E_PRIVATE_ASM_DISALLOWED) "A strongly-named assembly is required."
MSG_FOR_URT_HR(FUSION_E_INVALID_NAME) "The given assembly name was invalid."
MSG_FOR_URT_HR(FUSION_E_CACHEFILE_FAILED) "Failed to add file to AppDomain cache."
MSG_FOR_URT_HR(FUSION_E_APP_DOMAIN_LOCKED) "The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest."
MSG_FOR_URT_HR(COR_E_LOADING_REFERENCE_ASSEMBLY) "Reference assemblies cannot be loaded for execution."
MSG_FOR_URT_HR(COR_E_AMBIGUOUSIMPLEMENTATION) "Ambiguous implementation found."
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/pal/prebuilt/inc/corerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#define FUSION_E_REF_DEF_MISMATCH EMAKEHR(0x1040)
#define FUSION_E_PRIVATE_ASM_DISALLOWED EMAKEHR(0x1044)
#define FUSION_E_INVALID_NAME EMAKEHR(0x1047)
#define FUSION_E_CACHEFILE_FAILED EMAKEHR(0x1052)
#define FUSION_E_APP_DOMAIN_LOCKED EMAKEHR(0x1053)
#define COR_E_LOADING_REFERENCE_ASSEMBLY EMAKEHR(0x1058)
#define COR_E_AMBIGUOUSIMPLEMENTATION EMAKEHR(0x106a)
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/utilcode/ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ LPCSTR Exception::GetHRSymbolicName(HRESULT hr)
CASE_HRESULT(COR_E_APPDOMAINUNLOADED)
CASE_HRESULT(COR_E_CANNOTUNLOADAPPDOMAIN)
CASE_HRESULT(MSEE_E_ASSEMBLYLOADINPROGRESS)
CASE_HRESULT(FUSION_E_CACHEFILE_FAILED)
CASE_HRESULT(FUSION_E_REF_DEF_MISMATCH)
CASE_HRESULT(FUSION_E_PRIVATE_ASM_DISALLOWED)
CASE_HRESULT(FUSION_E_INVALID_NAME)
Expand Down
29 changes: 7 additions & 22 deletions src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3262,7 +3262,7 @@ PVOID AppDomain::GetFriendlyNameNoSet(bool* isUtf8)

#ifndef DACCESS_COMPILE

BOOL AppDomain::AddFileToCache(AssemblySpec* pSpec, PEAssembly * pPEAssembly, BOOL fAllowFailure)
BOOL AppDomain::AddFileToCache(AssemblySpec* pSpec, PEAssembly * pPEAssembly)
{
CONTRACTL
{
Expand All @@ -3274,25 +3274,10 @@ BOOL AppDomain::AddFileToCache(AssemblySpec* pSpec, PEAssembly * pPEAssembly, BO
}
CONTRACTL_END;

{
GCX_PREEMP();
DomainCacheCrstHolderForGCCoop holder(this);

// !!! suppress exceptions
if(!m_AssemblyCache.StorePEAssembly(pSpec, pPEAssembly) && !fAllowFailure)
{
// TODO: Disabling the below assertion as currently we experience
// inconsistency on resolving the Microsoft.Office.Interop.MSProject.dll
// This causes below assertion to fire and crashes the VS. This issue
// is being tracked with Dev10 Bug 658555. Brought back it when this bug
// is fixed.
// _ASSERTE(FALSE);

EEFileLoadException::Throw(pSpec, FUSION_E_CACHEFILE_FAILED, NULL);
}
}
GCX_PREEMP();
DomainCacheCrstHolderForGCCoop holder(this);

return TRUE;
return m_AssemblyCache.StorePEAssembly(pSpec, pPEAssembly);
}

BOOL AppDomain::AddAssemblyToCache(AssemblySpec* pSpec, DomainAssembly *pAssembly)
Expand Down Expand Up @@ -3505,10 +3490,10 @@ BOOL AppDomain::PostBindResolveAssembly(AssemblySpec *pPrePolicySpec,
// The binder does a re-fetch of the
// original binding spec and therefore will not cause inconsistency here.
// For the purposes of the resolve event, failure to add to the cache still is a success.
AddFileToCache(pPrePolicySpec, result, TRUE /* fAllowFailure */);
AddFileToCache(pPrePolicySpec, result);
if (*ppFailedSpec != pPrePolicySpec)
{
AddFileToCache(pPostPolicySpec, result, TRUE /* fAllowFailure */ );
AddFileToCache(pPostPolicySpec, result);
}
}
}
Expand Down Expand Up @@ -3569,7 +3554,7 @@ PEAssembly * AppDomain::BindAssemblySpec(
// Failure to add simply means someone else beat us to it. In that case
// the FindCachedFile call below (after catch block) will update result
// to the cached value.
AddFileToCache(pSpec, result, TRUE /*fAllowFailure*/);
AddFileToCache(pSpec, result);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ class AppDomain : public BaseDomain
BOOL IsCached(AssemblySpec *pSpec);
#endif // DACCESS_COMPILE

BOOL AddFileToCache(AssemblySpec* pSpec, PEAssembly *pPEAssembly, BOOL fAllowFailure = FALSE);
BOOL AddFileToCache(AssemblySpec* pSpec, PEAssembly *pPEAssembly);
BOOL RemoveFileFromCache(PEAssembly *pPEAssembly);

BOOL AddAssemblyToCache(AssemblySpec* pSpec, DomainAssembly *pAssembly);
Expand Down
15 changes: 0 additions & 15 deletions src/coreclr/vm/coreassemblyspec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,6 @@
#include "../binder/inc/assemblybindercommon.hpp"
#include "../binder/inc/applicationcontext.hpp"

static VOID ThrowLoadError(AssemblySpec * pSpec, HRESULT hr)
{
CONTRACTL
{
THROWS;
MODE_ANY;
GC_TRIGGERS;
}
CONTRACTL_END;

StackSString name;
pSpec->GetDisplayName(0, name);
EEFileLoadException::Throw(name, hr);
}

HRESULT AssemblySpec::Bind(AppDomain *pAppDomain, BINDER_SPACE::Assembly** ppAssembly)
{
CONTRACTL
Expand Down
14 changes: 0 additions & 14 deletions src/coreclr/vm/peimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,20 +387,6 @@ void PEImage::GetMVID(GUID *pMvid)
#endif // _DEBUG
}

void DECLSPEC_NORETURN PEImage::ThrowFormat(HRESULT hrError)
{
CONTRACTL
{
GC_TRIGGERS;
THROWS;
MODE_ANY;
}
CONTRACTL_END;

EEFileLoadException::Throw(m_path, hrError);
}


//may outlive PEImage
PEImage::IJWFixupData::IJWFixupData(void *pBase)
: m_lock(CrstIJWFixupData),
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/vm/peimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ class PEImage final
static BOOL CompareImage(UPTR image1, UPTR image2);
static BOOL CompareIJWDataBase(UPTR base, UPTR mapping);

void DECLSPEC_NORETURN ThrowFormat(HRESULT hr);

public:
class IJWFixupData
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/vm/rexcep.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ DEFINE_EXCEPTION(g_SystemNS, FieldAccessException, false, C

DEFINE_EXCEPTION(g_IONS, FileLoadException, true,
COR_E_FILELOAD,
FUSION_E_CACHEFILE_FAILED,
FUSION_E_INVALID_NAME,
FUSION_E_PRIVATE_ASM_DISALLOWED,
FUSION_E_REF_DEF_MISMATCH,
Expand Down
1 change: 0 additions & 1 deletion src/libraries/Common/src/System/HResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ internal static partial class HResults
internal const int STG_E_PATHNOTFOUND = unchecked((int)0x80030003);
internal const int CTL_E_PATHNOTFOUND = unchecked((int)0x800A004C);
internal const int CTL_E_FILENOTFOUND = unchecked((int)0x800A0035);
internal const int FUSION_E_CACHEFILE_FAILED = unchecked((int)0x80131052);
internal const int FUSION_E_INVALID_NAME = unchecked((int)0x80131047);
internal const int FUSION_E_PRIVATE_ASM_DISALLOWED = unchecked((int)0x80131044);
internal const int FUSION_E_REF_DEF_MISMATCH = unchecked((int)0x80131040);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ public static IntPtr GetHINSTANCE(Module m)
HResult = errorCode
};
}
case HResults.FUSION_E_CACHEFILE_FAILED:
case HResults.FUSION_E_INVALID_NAME:
case HResults.FUSION_E_PRIVATE_ASM_DISALLOWED:
case HResults.FUSION_E_REF_DEF_MISMATCH:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public static class HResults
public const int COR_E_EXCEPTION = unchecked((int)0x80131500);

public const int COR_E_FILELOAD = unchecked((int)0x80131621);
public const int FUSION_E_CACHEFILE_FAILED = unchecked((int)0x80131052);
public const int FUSION_E_INVALID_NAME = unchecked((int)0x80131047);
public const int FUSION_E_PRIVATE_ASM_DISALLOWED = unchecked((int)0x80131044);
public const int FUSION_E_REF_DEF_MISMATCH = unchecked((int)0x80131040);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public static class FileLoadExceptionInteropTests
{
[Theory]
[InlineData(HResults.COR_E_FILELOAD)]
[InlineData(HResults.FUSION_E_CACHEFILE_FAILED)]
[InlineData(HResults.FUSION_E_INVALID_NAME)]
[InlineData(HResults.FUSION_E_PRIVATE_ASM_DISALLOWED)]
[InlineData(HResults.FUSION_E_REF_DEF_MISMATCH)]
Expand Down