[linker] Mark declaring types of nested types resolved from xml descriptors. Fixes...
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 24 Aug 2016 10:12:48 +0000 (12:12 +0200)
committerGitHub <noreply@github.com>
Wed, 24 Aug 2016 10:12:48 +0000 (12:12 +0200)
If the declaring type of a nested type marked by an xml descriptor
is not otherwise marked, the members of the nested type will not
be preserved, because the linker will not process the nested type
(since the parent type isn't marked, MarkStep:InitializeAssembly
will skip it, and thus skip akk its nested types as well).

https://bugzilla.xamarin.com/show_bug.cgi?id=43658

mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs

index 5e9f681fd1784d25dfd201c93fc913c409c6fa9f..aa4f6afc760388c38a5f1267ab4f2aa69f9ce473 100644 (file)
@@ -174,6 +174,14 @@ namespace Mono.Linker.Steps {
 
                        Annotations.Mark (type);
 
+                       if (type.IsNested) {
+                               var parent = type;
+                               while (parent.IsNested) {
+                                       parent = parent.DeclaringType;
+                                       Annotations.Mark (parent);
+                               }
+                       }
+
                        switch (preserve) {
                        case TypePreserve.Nothing:
                                if (!nav.HasChildren)