From dc8b6f90a69a780ac9b8d76a5cc0c08ddd374eba Mon Sep 17 00:00:00 2001 From: Jeremy Barton Date: Thu, 16 Jul 2020 09:23:54 -0700 Subject: [PATCH] Add RequiresUnreferencedCodeAttribute to CryptoConfig --- .../ref/System.Security.Cryptography.Algorithms.cs | 2 ++ .../src/System/Security/Cryptography/CryptoConfig.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs index 3ed7662..caa58cf 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs @@ -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; } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs index d19dfb1..f82f782 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs @@ -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); -- 2.7.4