Bug 55436 - System.Runtime refuses to load with strict naming
Summary: System.Runtime refuses to load with strict naming
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 5.2 (2017-04)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Aleksey Kliger
URL:
Depends on:
Blocks:
 
Reported: 2017-04-20 20:51 UTC by Andi McClure
Modified: 2017-04-26 00:58 UTC (History)
3 users (show)

Tags: 2017-04
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andi McClure 2017-04-20 20:51:17 UTC
There is a macios test which you can run from the xamarin-macios repository with

(cd tests && (MONO_LOG_MASK=asm MONO_LOG_LEVEL=debug ./common/mac/TestProjects/ImmutableCollection_Test/ImmutableCollection_Test/bin/Debug/ImmutableCollection_Test.app/Contents/MacOS/ImmutableCollection_Test))

It builds a mac app which references System.Collections.Immutable. The mac app has mono and directly and indirectly referenced assemblies such as System.Collections.Immutable copied into it. When you build the app using the mono-2017-04 branch of xamarin-macios (the first to contain strong assembly naming rules) and run the app, it fails saying it cannot find System.Runtime:

https://gist.github.com/xmcclure/7424c4d60fa3743e9b5fdf828d581df3

If you look carefully, the reason this happens is because the version of System.Runtime copied into the .app is 4.1.0.0, but whoever referenced it used the 4.0.0.0 strong name at build time.

Our understanding is that this is not a bug in the assembly loaders but is a problem with the BCL we are distributing. Aleksey and Koeplinger believe this is something to do with the version numbers we assign facades. The possibility was raised that the facades are not in the remap table and this is the problem. It also might be that this is an early canary for a problem which will get more noticeable once strong name restrictions are added to all assembly loading paths.
Comment 1 Marek Safar 2017-04-24 08:56:38 UTC
I think https://github.com/mono/mono/pull/4730 could address this issue too
Comment 2 Aleksey Kliger 2017-04-24 17:57:18 UTC
Yes, this will be fixed by that PR.