Fixes remaining issues with DynamicDependency attribute and adds tests (#79398)
authorVitek Karas <10670590+vitek-karas@users.noreply.github.com>
Mon, 12 Dec 2022 10:33:54 +0000 (02:33 -0800)
committerGitHub <noreply@github.com>
Mon, 12 Dec 2022 10:33:54 +0000 (02:33 -0800)
commit705e071e1542b2f7706d08ca7b066eb3586248b2
treea4cd3dfc22cf02f73f881648a08b65967969986a
parent5a5ab5962e20d10718b326dda56dfc9285be9acf
Fixes remaining issues with DynamicDependency attribute and adds tests (#79398)

Ports over all DynamicDependencyAttribute tests we have in linker. All tests are now passing, two had to be partially disabled due to:
* copyused testing which NativeAOT doesn't really support
* known missing support for XML attribute files in AOT

Product changes:
* DynamicDependencyAttribute will produce a warning if it can't resolve the target of the dependency.
* Support for DynamicDependencyAttribute on fields

Small improvements to assembly checker - mainly ability to handle delegate types.

Add tests for reflection-only accessed fields and methods and DynamicDependency on them. Fixed the problem with those tests by also hooking up FieldMetadataNote and MethodMetadataNode.
46 files changed:
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DynamicDependencyAttributeAlgorithm.cs
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FieldMetadataNode.cs
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodMetadataNode.cs
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/AssemblyDependency.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/AssemblyDependencyWithMultipleReferences.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyFromAttributeXmlOnNonReferencedAssemblyLibrary.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyInCopyAssembly.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInAssemblyLibrary.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyBase.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyBase2.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedLibrary.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyLibrary.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyMethodInNonReferencedAssemblyLibrary.xml [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/DynamicDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/FacadeAssembly.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/ImplementationLibrary.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/ReferenceImplementationLibrary.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/Dependencies/UnusedAssemblyDependency.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyField.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.mono.Attributes.xml [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.netcore.Attributes.xml [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXmlOnNonReferencedAssembly.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXmlOnNonReferencedAssembly.mono.Attributes.xml [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXmlOnNonReferencedAssembly.netcore.Attributes.xml [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromCopiedAssembly.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyKeptOption.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMemberSignatureWildcard.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMemberTypes.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethod.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInAssembly.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssembly.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChained.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyChainedReference.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInNonReferencedAssemblyWithSweptReferences.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyOnForwardedType.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyOnUnusedMethodInNonReferencedAssembly.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs [new file with mode: 0644]
src/coreclr/tools/aot/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestDatabase.cs
src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestSuites.cs
src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs