Add RequiresUnreferencedCodeAttribute to CryptoConfig
authorJeremy Barton <jbarton@microsoft.com>
Thu, 16 Jul 2020 16:23:54 +0000 (09:23 -0700)
committerGitHub <noreply@github.com>
Thu, 16 Jul 2020 16:23:54 +0000 (09:23 -0700)
src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs

index 3ed7662..caa58cf 100644 (file)
@@ -94,7 +94,9 @@ namespace System.Security.Cryptography
         public static bool AllowOnlyFipsAlgorithms { get { throw null; } }
         public static void AddAlgorithm(System.Type algorithm, params string[] names) { }
         public static void AddOID(string oid, params string[] names) { }
+        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
         public static object? CreateFromName(string name) { throw null; }
+        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
         public static object? CreateFromName(string name, params object?[]? args) { throw null; }
         public static byte[] EncodeOID(string str) { throw null; }
         public static string? MapNameToOID(string name) { throw null; }
index d19dfb1..f82f782 100644 (file)
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using System.Collections.Concurrent;
 using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
 using System.Globalization;
 using System.Reflection;
 using System.Runtime.InteropServices;
@@ -323,6 +324,7 @@ namespace System.Security.Cryptography
             }
         }
 
+        [RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
         public static object? CreateFromName(string name, params object?[]? args)
         {
             if (name == null)
@@ -443,6 +445,7 @@ namespace System.Security.Cryptography
             return retval;
         }
 
+        [RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
         public static object? CreateFromName(string name)
         {
             return CreateFromName(name, null);