diff --git a/src/corehost/cli/fxr/fx_muxer.h b/src/corehost/cli/fxr/fx_muxer.h index a802d3043..0c2035bba 100644 --- a/src/corehost/cli/fxr/fx_muxer.h +++ b/src/corehost/cli/fxr/fx_muxer.h @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +class corehost_init_t; class runtime_config_t; struct fx_ver_t; diff --git a/src/corehost/cli/fxr/hostfxr.cpp b/src/corehost/cli/fxr/hostfxr.cpp index 0b83286ff..e81c1de45 100644 --- a/src/corehost/cli/fxr/hostfxr.cpp +++ b/src/corehost/cli/fxr/hostfxr.cpp @@ -5,10 +5,11 @@ #include "trace.h" #include "pal.h" #include "utils.h" -#include "libhost.h" #include "fx_ver.h" #include "fx_muxer.h" #include "error_codes.h" +#include "libhost.h" +#include "runtime_config.h" typedef int(*corehost_load_fn) (const corehost_init_t* init); typedef int(*corehost_main_fn) (const int argc, const pal::char_t* argv[]); @@ -59,7 +60,14 @@ int execute_app( if (code != StatusCode::Success) { - trace::error(_X("Could not load host policy library [%s]"), impl_dll_dir.c_str()); + trace::error(_X("Could not load host policy library from [%s]"), impl_dll_dir.c_str()); + if (init->fx_dir() == impl_dll_dir) + { + pal::string_t name = init->runtime_config()->get_fx_name(); + pal::string_t version = init->runtime_config()->get_fx_version(); + trace::error(_X("This may be because the targeted framework [%s %s] was not found."), + name.c_str(), version.c_str()); + } return code; } diff --git a/src/corehost/cli/hostpolicy.cpp b/src/corehost/cli/hostpolicy.cpp index efd99676b..795439f75 100644 --- a/src/corehost/cli/hostpolicy.cpp +++ b/src/corehost/cli/hostpolicy.cpp @@ -191,9 +191,14 @@ int run(const corehost_init_t* init, const runtime_config_t& config, const argum SHARED_API int corehost_load(corehost_init_t* init) { g_init = init; + + trace::setup(); + if (g_init->version() != corehost_init_t::s_version) { - trace::error(_X("The structure of init data has changed, do not know how to interpret it")); + trace::error(_X("Error loading hostpolicy %s; interface mismatch between hostpolicy [%d] and hostfxr [%d]"), + _STRINGIFY(HOST_POLICY_PKG_VER), corehost_init_t::s_version, g_init->version()); + trace::error(_X("Specifically, the structure of corehost_init_t has changed, do not know how to interpret it")); return StatusCode::LibHostInitFailure; } return 0; @@ -201,8 +206,6 @@ SHARED_API int corehost_load(corehost_init_t* init) SHARED_API int corehost_main(const int argc, const pal::char_t* argv[]) { - trace::setup(); - assert(g_init); if (trace::is_enabled())