diff --git a/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs b/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs index 17cacd877b0e..c3ede9165f8e 100644 --- a/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs +++ b/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -818,6 +818,7 @@ public override bool HandleCall (MethodBody callingMethodBody, MethodReference c // Intentionally ignore - it's not wrong for code to call Type.GetType on non-existing name, the code might expect null/exception back. reflectionContext.RecordHandledPattern (); } else { + _context.ProcessReferenceClosure (foundType.Module.Assembly); reflectionContext.RecordRecognizedPattern (foundType, () => _markStep.MarkTypeVisibleToReflection (foundTypeRef, new DependencyInfo (DependencyKind.AccessedViaReflection, callingMethodDefinition), callingMethodDefinition)); methodReturnValue = MergePointValue.MergeValues (methodReturnValue, new SystemTypeValue (foundType)); } @@ -1359,6 +1360,7 @@ void ProcessCreateInstanceByName (ref ReflectionPatternContext reflectionContext reflectionContext.RecordUnrecognizedPattern (2061, $"The assembly name '{assemblyNameStringValue.Contents}' passed to method '{calledMethod.GetDisplayName ()}' references assembly which is not available."); continue; } + _context.ProcessReferenceClosure (resolvedAssembly); var typeRef = _context.TypeNameResolver.ResolveTypeName (resolvedAssembly, typeNameStringValue.Contents); var resolvedType = typeRef?.Resolve (); @@ -1599,6 +1601,7 @@ void RequireDynamicallyAccessedMembers (ref ReflectionPatternContext reflectionC // Intentionally ignore - it's not wrong for code to call Type.GetType on non-existing name, the code might expect null/exception back. reflectionContext.RecordHandledPattern (); } else { + _context.ProcessReferenceClosure (foundType.Module.Assembly); MarkType (ref reflectionContext, typeRef); MarkTypeForDynamicallyAccessedMembers (ref reflectionContext, foundType, requiredMemberTypes); } diff --git a/src/linker/Linker.Steps/DynamicDependencyLookupStep.cs b/src/linker/Linker.Steps/DynamicDependencyLookupStep.cs index 61d07237390b..cea8dcc4567d 100644 --- a/src/linker/Linker.Steps/DynamicDependencyLookupStep.cs +++ b/src/linker/Linker.Steps/DynamicDependencyLookupStep.cs @@ -4,14 +4,13 @@ using System; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using Mono.Cecil; #nullable enable namespace Mono.Linker.Steps { - public class DynamicDependencyLookupStep : LoadReferencesStep + public class DynamicDependencyLookupStep : BaseStep { protected override void ProcessAssembly (AssemblyDefinition assembly) { @@ -74,7 +73,7 @@ void ProcessDynamicDependencyAttributes (IMemberDefinition member) var assembly = Context.Resolve (new AssemblyNameReference (assemblyName, new Version ())); if (assembly == null) continue; - ProcessReferences (assembly); + Context.ProcessReferenceClosure (assembly); } } @@ -90,8 +89,7 @@ void ProcessDynamicDependencyAttributes (IMemberDefinition member) Context.LogWarning ($"Unresolved assembly '{dynamicDependency.AssemblyName}' in 'DynamicDependencyAttribute'", 2035, member); continue; } - - ProcessReferences (assembly); + Context.ProcessReferenceClosure (assembly); } } diff --git a/src/linker/Linker.Steps/IAssemblyStep.cs b/src/linker/Linker.Steps/IAssemblyStep.cs new file mode 100644 index 000000000000..e4757169e576 --- /dev/null +++ b/src/linker/Linker.Steps/IAssemblyStep.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Mono.Cecil; +using System.Collections.Generic; + +namespace Mono.Linker.Steps +{ + public interface IAssemblyStep + { + void Initialize (LinkContext context); + void ProcessAssemblies (HashSet assembly); + } +} \ No newline at end of file diff --git a/src/linker/Linker.Steps/LinkAttributesStep.cs b/src/linker/Linker.Steps/LinkAttributesStep.cs index e0be36e38bec..2187f535a0ac 100644 --- a/src/linker/Linker.Steps/LinkAttributesStep.cs +++ b/src/linker/Linker.Steps/LinkAttributesStep.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -173,6 +173,8 @@ bool GetAttributeType (XPathNodeIterator iterator, string attributeFullName, out } attributeType = Context.TypeNameResolver.ResolveTypeName (assembly, attributeFullName)?.Resolve (); + if (attributeType != null) + Context.ProcessReferenceClosure (attributeType.Module.Assembly); } if (attributeType == null) { @@ -341,8 +343,7 @@ protected override AssemblyDefinition GetAssembly (LinkContext context, Assembly { var assembly = context.Resolve (assemblyName); if (assembly != null) - ProcessReferences (assembly); - + context.ProcessReferenceClosure (assembly); return assembly; } } diff --git a/src/linker/Linker.Steps/LoadReferencesStep.cs b/src/linker/Linker.Steps/LoadReferencesStep.cs index 59928adcb3f0..90a42aefebaa 100644 --- a/src/linker/Linker.Steps/LoadReferencesStep.cs +++ b/src/linker/Linker.Steps/LoadReferencesStep.cs @@ -1,4 +1,4 @@ -// +// // LoadReferencesStep.cs // // Author: @@ -32,13 +32,33 @@ namespace Mono.Linker.Steps { - public class LoadReferencesStep : BaseStep + public class LoadReferencesStep : IAssemblyStep { + LinkContext _context; + + LinkContext Context => _context; + readonly HashSet references = new HashSet (); - protected override void ProcessAssembly (AssemblyDefinition assembly) + readonly HashSet newReferences = new HashSet (); + + public void Initialize (LinkContext context) + { + _context = context; + } + + public virtual void ProcessAssemblies (HashSet assemblies) { - ProcessReferences (assembly); + newReferences.Clear (); + + foreach (var assembly in assemblies) + ProcessReferences (assembly); + + // Ensure that subsequent IAssemblySteps only process assemblies + // which have not already been processed. + assemblies.Clear (); + foreach (var assembly in newReferences) + assemblies.Add (assembly); } protected void ProcessReferences (AssemblyDefinition assembly) @@ -46,6 +66,8 @@ protected void ProcessReferences (AssemblyDefinition assembly) if (!references.Add (assembly.Name)) return; + newReferences.Add (assembly); + Context.RegisterAssembly (assembly); foreach (AssemblyDefinition referenceDefinition in Context.ResolveReferences (assembly)) { diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs index aeb4d7fc9509..dd97d12fc522 100644 --- a/src/linker/Linker.Steps/MarkStep.cs +++ b/src/linker/Linker.Steps/MarkStep.cs @@ -350,6 +350,9 @@ void Process () if (!assembly.MainModule.HasExportedTypes) continue; + // We may have resolved new type forwarder assemblies which have not been processed. + _context.ProcessReferenceClosure (assembly); + foreach (var exported in assembly.MainModule.ExportedTypes) { bool isForwarder = exported.IsForwarder; var declaringType = exported.DeclaringType; @@ -657,11 +660,12 @@ void MarkDynamicDependency (DynamicDependency dynamicDependency, IMemberDefiniti Debug.Assert (context is MethodDefinition || context is FieldDefinition); AssemblyDefinition assembly; if (dynamicDependency.AssemblyName != null) { - assembly = _context.GetLoadedAssembly (dynamicDependency.AssemblyName); + assembly = _context.Resolve (dynamicDependency.AssemblyName); if (assembly == null) { _context.LogWarning ($"Unresolved assembly '{dynamicDependency.AssemblyName}' in 'DynamicDependencyAttribute'", 2035, context); return; } + _context.ProcessReferenceClosure (assembly); } else { assembly = context.DeclaringType.Module.Assembly; Debug.Assert (assembly != null); @@ -765,12 +769,13 @@ protected virtual void MarkUserDependency (MemberReference context, CustomAttrib AssemblyDefinition assembly; var args = ca.ConstructorArguments; if (args.Count >= 3 && args[2].Value is string assemblyName) { - assembly = _context.GetLoadedAssembly (assemblyName); + assembly = _context.Resolve (assemblyName); if (assembly == null) { _context.LogWarning ( $"Could not resolve dependency assembly '{assemblyName}' specified in a 'PreserveDependency' attribute", 2003, context.Resolve ()); return; } + _context.ProcessReferenceClosure (assembly); } else { assembly = null; } @@ -1590,12 +1595,19 @@ TypeDefinition GetDebuggerAttributeTargetType (CustomAttribute ca, AssemblyDefin if (property.Name == "TargetTypeName") { string targetTypeName = (string) property.Argument.Value; TypeName typeName = TypeParser.ParseTypeName (targetTypeName); + TypeDefinition typeDef; if (typeName is AssemblyQualifiedTypeName assemblyQualifiedTypeName) { AssemblyDefinition assembly = _context.GetLoadedAssembly (assemblyQualifiedTypeName.AssemblyName.Name); - return _context.TypeNameResolver.ResolveTypeName (assembly, targetTypeName)?.Resolve (); + typeDef = _context.TypeNameResolver.ResolveTypeName (assembly, targetTypeName)?.Resolve (); + if (typeDef != null) + _context.ProcessReferenceClosure (typeDef.Module.Assembly); + return typeDef; } - return _context.TypeNameResolver.ResolveTypeName (asm, targetTypeName)?.Resolve (); + typeDef = _context.TypeNameResolver.ResolveTypeName (asm, targetTypeName)?.Resolve (); + if (typeDef != null) + _context.ProcessReferenceClosure (typeDef.Module.Assembly); + return typeDef; } } @@ -1689,6 +1701,9 @@ protected virtual void MarkTypeConverterLikeDependency (CustomAttribute attribut switch (attribute.ConstructorArguments[0].Value) { case string s: tdef = _context.TypeNameResolver.ResolveTypeName (s)?.Resolve (); + if (tdef != null) + _context.ProcessReferenceClosure (tdef.Module.Assembly); + // ResolveTypeName might resolve an assembly (or multiple assemblies for generic arguments...) break; case TypeReference type: tdef = type.Resolve (); diff --git a/src/linker/Linker.Steps/ProcessLinkerXmlStepBase.cs b/src/linker/Linker.Steps/ProcessLinkerXmlStepBase.cs index 264bd821b2f7..f955fabc489a 100644 --- a/src/linker/Linker.Steps/ProcessLinkerXmlStepBase.cs +++ b/src/linker/Linker.Steps/ProcessLinkerXmlStepBase.cs @@ -7,7 +7,7 @@ namespace Mono.Linker.Steps { - public abstract class ProcessLinkerXmlStepBase : LoadReferencesStep + public abstract class ProcessLinkerXmlStepBase : BaseStep { const string FullNameAttributeName = "fullname"; const string LinkerElementName = "linker"; diff --git a/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs b/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs index a3bc7e897b02..3138eecd618e 100644 --- a/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs +++ b/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs @@ -67,6 +67,7 @@ protected override void Process () Context.Resolver.IgnoreUnresolved = false; AssemblyDefinition assembly = _assembly ?? Context.Resolve (_file); Context.Resolver.IgnoreUnresolved = ignoreUnresolved; + Context.ProcessReferenceClosure (assembly); if (_rootVisibility != RootVisibility.Any && HasInternalsVisibleTo (assembly)) _rootVisibility = RootVisibility.PublicAndFamilyAndAssembly; diff --git a/src/linker/Linker.Steps/ResolveFromXmlStep.cs b/src/linker/Linker.Steps/ResolveFromXmlStep.cs index f7cd9a5e59ff..f476313d5676 100644 --- a/src/linker/Linker.Steps/ResolveFromXmlStep.cs +++ b/src/linker/Linker.Steps/ResolveFromXmlStep.cs @@ -320,8 +320,7 @@ protected override AssemblyDefinition GetAssembly (LinkContext context, Assembly { var assembly = context.Resolve (assemblyName); if (assembly != null) - ProcessReferences (assembly); - + context.ProcessReferenceClosure (assembly); return assembly; } diff --git a/src/linker/Linker.Steps/TypeMapStep.cs b/src/linker/Linker.Steps/TypeMapStep.cs index de4f323a6ed7..336f107ce0e8 100644 --- a/src/linker/Linker.Steps/TypeMapStep.cs +++ b/src/linker/Linker.Steps/TypeMapStep.cs @@ -32,13 +32,22 @@ namespace Mono.Linker.Steps { - public class TypeMapStep : BaseStep + public class TypeMapStep : IAssemblyStep { + LinkContext _context; + AnnotationStore Annotations => _context.Annotations; - protected override void ProcessAssembly (AssemblyDefinition assembly) + public void Initialize (LinkContext context) { - foreach (TypeDefinition type in assembly.MainModule.Types) - MapType (type); + _context = context; + } + + public void ProcessAssemblies (HashSet assemblies) + { + foreach (var assembly in assemblies) { + foreach (TypeDefinition type in assembly.MainModule.Types) + MapType (type); + } } protected virtual void MapType (TypeDefinition type) diff --git a/src/linker/Linker/Driver.cs b/src/linker/Linker/Driver.cs index 707341dbd0bd..02e85ad1faa6 100644 --- a/src/linker/Linker/Driver.cs +++ b/src/linker/Linker/Driver.cs @@ -707,7 +707,6 @@ protected int SetupContext (ILogger customLogger = null) // ResolveFromAssemblyStep [optional, possibly many] // ResolveFromXmlStep [optional, possibly many] // [mono only] ResolveFromXApiStep [optional, possibly many] - // LoadReferencesStep // [mono only] LoadI18nAssemblies // BlacklistStep // dynamically adds steps: @@ -717,7 +716,6 @@ protected int SetupContext (ILogger customLogger = null) // LinkAttributesStep [optional, possibly many] // DynamicDependencyLookupStep // [mono only] PreserveCalendarsStep [optional] - // TypeMapStep // BodySubstituterStep [optional] // RemoveSecurityStep [optional] // [mono only] RemoveFeaturesStep [optional] @@ -732,6 +730,12 @@ protected int SetupContext (ILogger customLogger = null) // RegenerateGuidStep [optional] // SealerStep // OutputStep + + // + // Pipeline Steps which run when new assemblies are processed + // + // LoadReferencesStep + // TypeMapStep // foreach (string custom_step in custom_steps) { @@ -1213,10 +1217,8 @@ static void About () static Pipeline GetStandardPipeline () { Pipeline p = new Pipeline (); - p.AppendStep (new LoadReferencesStep ()); p.AppendStep (new BlacklistStep ()); p.AppendStep (new DynamicDependencyLookupStep ()); - p.AppendStep (new TypeMapStep ()); p.AppendStep (new MarkStep ()); p.AppendStep (new ValidateVirtualMethodAnnotationsStep ()); p.AppendStep (new ProcessWarningsStep ()); @@ -1225,6 +1227,8 @@ static Pipeline GetStandardPipeline () p.AppendStep (new CleanStep ()); p.AppendStep (new RegenerateGuidStep ()); p.AppendStep (new OutputStep ()); + p.AppendAssemblyStep (new LoadReferencesStep ()); + p.AppendAssemblyStep (new TypeMapStep ()); return p; } diff --git a/src/linker/Linker/LinkContext.cs b/src/linker/Linker/LinkContext.cs index dddf2b8a1c58..09e999b71276 100644 --- a/src/linker/Linker/LinkContext.cs +++ b/src/linker/Linker/LinkContext.cs @@ -305,6 +305,15 @@ public TypeDefinition GetType (string fullName) return assembly.MainModule.GetType (fullName); } + // Run the per-assembly logic on a new assembly. + // Each step may modify the context of assemblies passed to the next. + public void ProcessReferenceClosure (AssemblyDefinition assembly) + { + var assemblies = new HashSet { assembly }; + foreach (var step in Pipeline.GetAssemblySteps ()) + step.ProcessAssemblies (assemblies); + } + public AssemblyDefinition Resolve (string name) { if (File.Exists (name)) { diff --git a/src/linker/Linker/Pipeline.cs b/src/linker/Linker/Pipeline.cs index 0aa5a3d1ae8b..82697e316c9d 100644 --- a/src/linker/Linker/Pipeline.cs +++ b/src/linker/Linker/Pipeline.cs @@ -38,10 +38,12 @@ public class Pipeline { readonly List _steps; + readonly List _assemblySteps; public Pipeline () { _steps = new List (); + _assemblySteps = new List (); } public void PrependStep (IStep step) @@ -54,6 +56,11 @@ public void AppendStep (IStep step) _steps.Add (step); } + public void AppendAssemblyStep (IAssemblyStep step) + { + _assemblySteps.Add (step); + } + public void AddStepBefore (Type target, IStep step) { for (int i = 0; i < _steps.Count; i++) { @@ -123,6 +130,9 @@ public void RemoveStep (Type target) public void Process (LinkContext context) { + foreach (var step in _assemblySteps) + step.Initialize (context); + while (_steps.Count > 0) { IStep step = _steps[0]; ProcessStep (context, step); @@ -140,6 +150,11 @@ public IStep[] GetSteps () return _steps.ToArray (); } + public IAssemblyStep[] GetAssemblySteps () + { + return _assemblySteps.ToArray (); + } + public bool ContainsStep (Type type) { foreach (IStep step in _steps) diff --git a/src/linker/Linker/TypeNameResolver.cs b/src/linker/Linker/TypeNameResolver.cs index aa6db7bff128..c9388a2f7a49 100644 --- a/src/linker/Linker/TypeNameResolver.cs +++ b/src/linker/Linker/TypeNameResolver.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection.Runtime.TypeParsing; using Mono.Cecil; @@ -49,7 +49,7 @@ TypeReference ResolveTypeName (AssemblyDefinition assembly, TypeName typeName) { if (typeName is AssemblyQualifiedTypeName assemblyQualifiedTypeName) { // In this case we ignore the assembly parameter since the type name has assembly in it - var assemblyFromName = _context.GetLoadedAssembly (assemblyQualifiedTypeName.AssemblyName.Name); + var assemblyFromName = _context.Resolve (assemblyQualifiedTypeName.AssemblyName.Name); return ResolveTypeName (assemblyFromName, assemblyQualifiedTypeName.TypeName); } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs index 4dc91982e7e1..8312e297cefe 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs @@ -7,6 +7,9 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Reference ("System.dll")] [SetupLinkerCoreAction ("link")] + // IComponent has TypeConverterAttribute referencing System.dll, which has + // unresolved references to Win32 assemblies. + [SetupLinkerArgument ("--skip-unresolved", "true")] [KeptAttributeInAssembly (PlatformAssemblies.CoreLib, typeof (AssemblyDescriptionAttribute))] [KeptAttributeInAssembly (PlatformAssemblies.CoreLib, typeof (AssemblyCompanyAttribute))] #if !NETCOREAPP diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs b/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs index 133e92b686d2..3f69eb9384ea 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs @@ -5,6 +5,9 @@ namespace Mono.Linker.Tests.Cases.CoreLink { [SetupLinkerCoreAction ("copy")] + // Color has TypeConverterAttribute referencing System.Drawing.dll, which has + // unresolved reference to System.Drawing.Common. + [SetupLinkerArgument ("--skip-unresolved")] [KeptAssembly (PlatformAssemblies.CoreLib)] [KeptAllTypesAndMembersInAssembly (PlatformAssemblies.CoreLib)] diff --git a/test/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary.cs b/test/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary.cs index 58d60c825b77..2aeca1b61fa4 100644 --- a/test/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary.cs @@ -11,7 +11,7 @@ public override string Method () return "Dependency"; } - [DynamicDependency (".ctor()", "Mono.Linker.Tests.Cases.Advanced.Dependencies.DynamicDependencyMethodInNonReferencedAssemblyBase2", "base2")] + [DynamicDependency ("#ctor()", "Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies.DynamicDependencyMethodInNonReferencedAssemblyBase2", "base2")] public static void Dependency () { } diff --git a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssembly.cs b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssembly.cs index c92206bcdbd7..35dd9b9573ec 100644 --- a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssembly.cs @@ -1,5 +1,4 @@ using System.Diagnostics.CodeAnalysis; -using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; diff --git a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChained.cs b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChained.cs index b73048b63342..3f43c89602cc 100644 --- a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChained.cs +++ b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChained.cs @@ -1,12 +1,10 @@ using System.Diagnostics.CodeAnalysis; -using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.DynamicDependencies { - [IgnoreTestCase ("Currently failing")] [SetupCompileBefore ("base.dll", new[] { "Dependencies/DynamicDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ("base2.dll", new[] { "Dependencies/DynamicDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new[] { "base.dll" }, addAsReference: false)] [SetupCompileBefore ("library.dll", new[] { "Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] @@ -26,7 +24,7 @@ public static void Main () } [Kept] - [DynamicDependency (".ctor()", "Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies.DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary", "library")] + [DynamicDependency ("#ctor()", "Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies.DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary", "library")] static void Dependency () { } diff --git a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedReference.cs b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedReference.cs index f6ee655ec6ff..32fd60d5f8b8 100644 --- a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedReference.cs +++ b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedReference.cs @@ -1,12 +1,10 @@ using System.Diagnostics.CodeAnalysis; -using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.DynamicDependencies { - [IgnoreTestCase ("Currently failing")] [SetupCompileBefore ("base.dll", new[] { "Dependencies/DynamicDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ("base2.dll", new[] { "Dependencies/DynamicDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new[] { "base.dll" }, addAsReference: false)] [SetupCompileBefore ("reference.dll", new[] { "Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] @@ -29,7 +27,7 @@ public static void Main () } [Kept] - [DynamicDependency (".ctor()", "Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies.DynamicDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary", "library")] + [DynamicDependency ("#ctor()", "Mono.Linker.Tests.Cases.DynamicDependencies.Dependencies.DynamicDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary", "library")] static void Dependency () { } diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs index 69897dc76f7a..82d25dd6f1ff 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs @@ -10,7 +10,7 @@ public override string Method () return "Dependency"; } - [PreserveDependency (".ctor()", "Mono.Linker.Tests.Cases.Advanced.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyBase2", "base2")] + [PreserveDependency (".ctor()", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyBase2", "base2")] public static void Dependency () { } diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyErrorCases.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyErrorCases.cs index 2adca1e4e137..ffad45b3a42d 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyErrorCases.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyErrorCases.cs @@ -1,5 +1,4 @@ -using System; -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs index 9d7f9f584640..32314c0ae40e 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs @@ -5,11 +5,10 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { - [IgnoreTestCase ("Currently failing")] [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ("base2.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new[] { "base.dll" }, addAsReference: false)] - [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll", "FakeSystemAssembly.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] [KeptAssembly ("base2.dll")] [KeptAssembly ("library.dll")] diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs index 105ace452a91..754c0f4e71e0 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs @@ -5,11 +5,10 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { - [IgnoreTestCase ("Currently failing")] [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ("base2.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new[] { "base.dll" }, addAsReference: false)] - [SetupCompileBefore ("reference.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] + [SetupCompileBefore ("reference.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll", "FakeSystemAssembly.dll" }, addAsReference: false)] [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs" }, references: new[] { "base.dll", "reference.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] [KeptAssembly ("base2.dll")] diff --git a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs index 99a5ecbf8d7a..303c2e3ae0e7 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs @@ -5,7 +5,6 @@ namespace Mono.Linker.Tests.Cases.Reflection { - [IgnoreTestCase ("Requires support for using a type in an unreferences assembly via reflection")] [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyDependency.cs" }, addAsReference: false)] [KeptAssembly ("library.dll")] [KeptTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.Reflection.Dependencies.AssemblyDependency")] diff --git a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs index b5ba1746130a..6cd6beaddf19 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs @@ -5,7 +5,6 @@ namespace Mono.Linker.Tests.Cases.Reflection { - [IgnoreTestCase ("Requires support for using a type in an unreferences assembly via reflection")] [SetupCompileBefore ("base.dll", new[] { "Dependencies/AssemblyImportedViaReflectionWithDerivedType_Base.cs" })] [SetupCompileBefore ("reflection.dll", new[] { "Dependencies/AssemblyImportedViaReflectionWithDerivedType_Reflect.cs" }, references: new[] { "base.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] diff --git a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs index 0cdb848e3534..ab4bc5c634ca 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs @@ -4,7 +4,6 @@ namespace Mono.Linker.Tests.Cases.Reflection { - [IgnoreTestCase ("Requires support for using a type in an unreferences assembly via reflection")] [SetupCompileBefore ("reference.dll", new[] { "Dependencies/AssemblyDependency.cs" }, addAsReference: false)] [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyDependencyWithReference.cs" }, references: new[] { "reference.dll" }, addAsReference: false)] [KeptAssembly ("reference.dll")]