Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added and modified suppressions
  • Loading branch information
jkurdek authored and vitek-karas committed Aug 10, 2022
commit 40fa30aa9f41b157e1d7fc03706836ab6b88efa3
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ private static class UnboxT<T>
{
internal static readonly Func<object, T?> s_unbox = Create();

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2090:MakeGenericMethod",
Justification = "'NullableField<TElem> where TElem : struct' implies 'TElem : new()'. Nullable does not make use of new() so it is safe.")]
private static Func<object, T?> Create()
{
if (typeof(T).IsValueType && default(T) == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public override bool CanConvert(Type typeToConvert) =>

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "The ctor is marked RequiresUnreferencedCode.")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType",
Justification = "The ctor is marked RequiresUnreferencedCode.")]
public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)
{
Debug.Assert(CanConvert(typeToConvert));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static JsonConverter Create(Type enumType, EnumConverterOptions convert
new object?[] { converterOptions, namingPolicy, options })!;
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType",
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern",
Justification = "'EnumConverter<T> where T : struct' implies 'T : new()', so the trimmer is warning calling MakeGenericType here because enumType's constructors are not annotated. " +
"But EnumConverter doesn't call new T(), so this is safe.")]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static JsonConverter CreateValueConverter(Type valueTypeToConvert, JsonCo
culture: null)!;
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType",
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern",
Justification = "'NullableConverter<T> where T : struct' implies 'T : new()', so the trimmer is warning calling MakeGenericType here because valueTypeToConvert's constructors are not annotated. " +
"But NullableConverter doesn't call new T(), so this is safe.")]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
Expand Down