From be62eed772e39768e499a59bdf1e7e0d5c3ffe9e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 2 Aug 2022 20:36:23 +0200 Subject: [PATCH] Replace pragma with [UnconditionalSuppressMessage] in TypeInfo --- src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs index cc860a7e..6e4939bf 100644 --- a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs +++ b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs @@ -21,6 +21,10 @@ internal static class TypeInfo<[DynamicallyAccessedMembers(DynamicallyAccessedMe /// /// The current type to check. /// Whether or not is or contains a field. + [UnconditionalSuppressMessage( + "ReflectionAnalysis", + "IL2026:RequiresUnreferencedCode", + Justification = "The types of all fields (recursively) are already guaranteed to be preserved given it's all value types (plus T is already annotated).")] private static bool ChecksIsDoubleOrContainsDoubles([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] Type type) { if (type == typeof(double)) return true; @@ -29,9 +33,7 @@ internal static class TypeInfo<[DynamicallyAccessedMembers(DynamicallyAccessedMe foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { -#pragma warning disable IL2072 // 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.NonPublicFields' if (ChecksIsDoubleOrContainsDoubles(fieldInfo.FieldType)) -#pragma warning restore IL2072 { return true; }