Merge pull request #2301 from schellap/dev-json

Improve logging when hostpolicy is not found
This commit is contained in:
Senthil 2016-04-06 19:26:33 -07:00
commit 29183b045e
3 changed files with 17 additions and 5 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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())