Bug 39047 - Verify Mono doesn't use a reference assembly mscorlib.dll on startup and provide clear error
Summary: Verify Mono doesn't use a reference assembly mscorlib.dll on startup and prov...
Status: RESOLVED DUPLICATE of bug 42584
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Aleksey Kliger
URL:
Depends on:
Blocks:
 
Reported: 2016-02-23 15:52 UTC by Alexander Köplinger [MSFT]
Modified: 2016-08-24 08:50 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Alexander Köplinger [MSFT] 2016-02-23 15:52:27 UTC
In the past we had some hard to diagnose issues like https://bugzilla.xamarin.com/show_bug.cgi?id=38813 where reference assemblies were inadvertently used during runtime.

We should add proper validation so that we abort early and with a nice error message when Mono tries to use reference assemblies instead of the implementation assemblies (whatever the cause is, because this is never valid during runtime).

Right now, we only run cil-strip on the implementation assemblies to generate the ref asms which just empties method bodies, so it could be a bit more difficult to tell the assemblies apart. But we should at least assert that some fundamental types in corlib have method bodies.

In the future, it might be a good idea to annotate our ref asms with the [ReferenceAssembly] attribute (see https://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.referenceassemblyattribute(v=vs.110).aspx) so we could more easily detect and deny all reference assemblies.
Comment 1 Alexander Köplinger [MSFT] 2016-07-27 10:24:33 UTC
Issues like https://bugzilla.xamarin.com/show_bug.cgi?id=42584 (and numerous others) would be way easier to diagnose if we had this.

CoreCLR does the check here: https://github.com/dotnet/coreclr/blob/775003a4c72f0acc37eab84628fcef541533ba4e/src/vm/pefile.inl#L139-L148
Comment 2 Marek Safar 2016-08-24 08:50:16 UTC

*** This bug has been marked as a duplicate of bug 42584 ***

Note You need to log in before you can comment on or make changes to this bug.