Skip to content
Open
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
40 changes: 9 additions & 31 deletions src/coreclr/binder/assemblybindercommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "failurecache.hpp"
#include "utils.hpp"
#include "stringarraylist.h"
#include "configuration.h"

#if !defined(DACCESS_COMPILE)
#include "defaultassemblybinder.h"
Expand Down Expand Up @@ -295,37 +294,16 @@ namespace BINDER_SPACE

BinderTracing::PathProbed(sCoreLib, pathSource, hr);

if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
&& Bundle::AppIsBundle()
&& Bundle::AppBundle->HasExtractedFiles())
{
// Try to find corelib in the TPA
StackSString sCoreLibSimpleName(CoreLibName_W);
StackSString sTrustedPlatformAssemblies = Configuration::GetKnobStringValue(W("TRUSTED_PLATFORM_ASSEMBLIES"));
sTrustedPlatformAssemblies.Normalize();

bool found = false;
for (SString::Iterator i = sTrustedPlatformAssemblies.Begin(); i != sTrustedPlatformAssemblies.End(); )
{
SString fileName;
SString simpleName;
HRESULT pathResult = S_OK;
IF_FAIL_GO(pathResult = GetNextTPAPath(sTrustedPlatformAssemblies, i, /*dllOnly*/ true, fileName, simpleName));
if (pathResult == S_FALSE)
{
break;
}

if (simpleName.EqualsCaseInsensitive(sCoreLibSimpleName))
{
sCoreLib = fileName;
found = true;
break;
}
}

if (!found)
{
GO_WITH_HRESULT(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
}
// For a single-file app with extracted contents (IncludeAllContentForSelfExtract),
// CoreCLR is statically linked into the host executable, so systemDirectory is the
// directory of the host executable. The extracted CoreLib lives in the bundle
// extraction directory rather than beside the host. Try to find it there.
sCoreLib.Set(Bundle::AppBundle->ExtractionPath());
CombinePath(sCoreLib, sCoreLibName, sCoreLib);

hr = AssemblyBinderCommon::GetAssembly(sCoreLib,
TRUE /* fIsInTPA */,
Expand Down
12 changes: 8 additions & 4 deletions src/coreclr/hosts/corerun/corerun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ static int run(const configuration& config)
{
// Use the external assembly probe to load assemblies from the app assembly paths.
use_external_assembly_probe = true;
}
else
{
tpa_list = std::move(app_assemblies_env);
}

if (use_external_assembly_probe)
{
if (!core_libs.empty())
{
pal::string_utf8_t core_libs_utf8 = pal::convert_to_utf8(core_libs.c_str());
Expand All @@ -459,10 +467,6 @@ static int run(const configuration& config)
::strcpy(s_core_root_path, core_root_utf8.c_str());
}
}
else
{
tpa_list = std::move(app_assemblies_env);
}

{
// Load hostpolicy if requested.
Expand Down
Loading