From 434df5b15ed2f86e3166118d62890502110cb4c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksey=20Kliger=20=28=CE=BBgeek=29?= Date: Tue, 16 Jul 2019 14:30:16 -0400 Subject: [PATCH] [netcore] Use the strict loader (mono/mono#15668) Mono historically was quite lax in how it resolved assembly references - it would pick the first assembly with a matching simple name. The "strict" mode (available in framework Mono with `--assembly-loader=strict`) follows the spec behavior: the version and public key token of the candidate assembly must match what is requested. Commit migrated from https://github.com/mono/mono/commit/d8a679375d706e992d590c3eb90e1c57cb2864e7 --- src/mono/mono/mini/main-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mono/mono/mini/main-core.c b/src/mono/mono/mini/main-core.c index e0f01d3..6ac0f1e 100644 --- a/src/mono/mono/mini/main-core.c +++ b/src/mono/mono/mini/main-core.c @@ -227,6 +227,12 @@ int STDAPICALLTYPE coreclr_initialize (const char* exePath, const char* appDomai if (native_lib_paths != NULL) mono_set_pinvoke_search_directories (native_lib_paths->dir_count, native_lib_paths->dirs); + /* + * Don't use Mono's legacy assembly name matching behavior - respect + * the requested version and public key token. + */ + mono_loader_set_strict_strong_names (TRUE); + return 0; } -- 2.7.4