diff options
author | Sebastien Pouliot <sebastien.pouliot@gmail.com> | 2016-12-16 19:13:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-16 19:13:57 +0300 |
commit | df81fe40c5f3324d2aad9caccf85a04142aa9cc3 (patch) | |
tree | 3cb5a807b4500fc4ebdb6999c8231f24cf103b28 | |
parent | 1e31bd78e69569c9e26a7d5018660ad389112b17 (diff) |
Fix marking types inside custom attributes. Fixes #47064 (#4126)mono-4.8.0.395
The existing code for marking custom attributes was only marking the type
and the lowest element type, i.e. marking (1) would also mark (3) but
would miss (2).
1. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[][]))]
2. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[]))]
3. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>))]
That's generally not an issue since the type is marked (elsewhere).
However, in the case of custom attributes, we need to update the Scope
to what was resolved (and that was missed).
That lack of updated Scope means that a PCL assembly would still keep
references to System.Runtime, which is something that the linker is
eliminating (causing a TypeLoadException at runtime)
reference:
* https://bugzilla.xamarin.com/show_bug.cgi?id=47064
Note: The linker is not in mono/master and there's a PR in the new
linker repo for the same https://github.com/mono/linker/pull/7
-rw-r--r-- | mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs index 9bf293d7f13..5c205f37911 100644 --- a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs +++ b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs @@ -372,7 +372,7 @@ namespace Mono.Linker.Steps { // e.g. System.String[] -> System.String var ts = (type as TypeSpecification); if (ts != null) { - MarkWithResolvedScope (ts.GetElementType ()); + MarkWithResolvedScope (ts.ElementType); return; } |