Примеры ошибок, обнаруженных с помощью диагностики V3180
V3180. The 'HasFlag' method always returns 'true' because the value '0' is passed as its argument.
RavenDB
V3180 The 'HasFlag' method always returns 'true' because the value of 'TypeAttributes.NotPublic' is '0', and it is passed as the method's argument. ExpressionStringBuilder.cs 2117
[Flags]
public enum TypeAttributes
{
....
NotPublic = 0,
....
}
private static bool CheckIfAnonymousType(Type type)
{
// hack: the only way to detect anonymous types right now
return type.IsDefined(typeof(CompilerGeneratedAttribute), false)
&& type.IsGenericType && type.Name.Contains("AnonymousType")
&& (type.Name.StartsWith("<>") || type.Name.StartsWith("VB$"))
&& type.Attributes.HasFlag(TypeAttributes.NotPublic); // <=
}