Skip to content
Merged
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
Suppres UnrecognizedReflectionPattern for GetField and GetConstructor
  • Loading branch information
BartoszKlonowski committed Jul 14, 2021
commit f039dc9a4f9eb2a0a706f19d3efa66de6a2e20f7
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,8 @@ private static bool IsValidGetMethodType(Type type)

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern",
Justification = "Linker thinks Type.GetConstructor(ConstructorInfo) is one of the public APIs because it doesn't analyze method signatures. We already have ConstructorInfo.")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:UnrecognizedReflectionPattern",
Justification = "Type.MakeGenericType is used to create a typical instantiation")]
public static ConstructorInfo GetConstructor(Type type, ConstructorInfo constructor)
{
if (!IsValidGetMethodType(type))
Expand Down Expand Up @@ -1914,6 +1916,8 @@ public static MethodInfo GetMethod(Type type, MethodInfo method)
return res;
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:UnrecognizedReflectionPattern",
Justification = "Type.MakeGenericType is used to create a typical instantiation")]
public static FieldInfo GetField(Type type, FieldInfo field)
{
if (!IsValidGetMethodType(type))
Expand Down