With dotnet/runtime#84468, EncryptedXml is now marked as RequiresUnreferencedCode. This is because
The algorithm implementations referenced in the XML payload might be removed. Ensure the required algorithm implementations are preserved in your application.
From discussion in #47410 (comment), we should:
- Figure out the list of commonly used crypto algorithms used by DataProtection, and add
[DynamicDependency] attributes for them.
- We also add some trimming/aot tests to ensure DataProtection works correctly when trimmed.
- DataProtection then suppresses the warnings coming from
System.Security.Cryptography.Xml