From 30167bc6ca221f4bbda411b0678afbde5b26c20f Mon Sep 17 00:00:00 2001 From: dahall Date: Thu, 22 Oct 2020 14:31:33 -0600 Subject: [PATCH] Fixed bug with CorrespondingTypeAttribute.GetAttrForEnum with default action --- Core/InteropServices/CorrespondingTypeAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/InteropServices/CorrespondingTypeAttribute.cs b/Core/InteropServices/CorrespondingTypeAttribute.cs index 66a6b926..8e497ebb 100644 --- a/Core/InteropServices/CorrespondingTypeAttribute.cs +++ b/Core/InteropServices/CorrespondingTypeAttribute.cs @@ -183,7 +183,7 @@ namespace Vanara.InteropServices protected static IEnumerable GetAttrForEnum(TEnum value, CorrespondingAction action = (CorrespondingAction)0xf) where TEnum : System.Enum { var valueType = value.GetType(); - var attr = valueType.GetField(value.ToString()).GetCustomAttributes(false, a => a.Action.HasFlag(action)); + var attr = valueType.GetField(value.ToString()).GetCustomAttributes(false, a => (a.Action & action) > 0); if (attr.Any(a => a.Action == CorrespondingAction.Exception)) throw new Exception(); //if (!attr.Any()) return new CorrespondingTypeAttribute[0]; return attr;