peass-ng/PEASS-ng · error · ArgumentException

Not an enumeration type

Error message

Not an enumeration type

What it means

A type validation guard in Enums.GetEnumValues: the method reflects over the supplied System.Type to enumerate its values and requires it to be an enum type; IsEnumType returned false, so the non-enum Type was rejected via this ArgumentException. The faulting input is the 'enumType' argument, e.g. a class or value type passed where an enum Type was expected.

Source

Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/util/Enums.cs:41

#if NETCF_1_0
                FieldInfo field = enumType.GetField(s, BindingFlags.Static | BindingFlags.Public);
                if (field != null)
                {
                    return (Enum)field.GetValue(null);
                }
#else
                return (Enum)Enum.Parse(enumType, s, false);
#endif		
            }

            throw new ArgumentException();
        }

        internal static Array GetEnumValues(System.Type enumType)
        {
            if (!IsEnumType(enumType))
                throw new ArgumentException("Not an enumeration type", "enumType");

#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT
            IList result = Platform.CreateArrayList();
            FieldInfo[] fields = enumType.GetFields(BindingFlags.Static | BindingFlags.Public);
            foreach (FieldInfo field in fields)
            {
                // Note: Argument to GetValue() ignored since the fields are static,
                //     but Silverlight for Windows Phone throws exception if we pass null
                result.Add(field.GetValue(enumType));
            }
            object[] arr = new object[result.Count];
            result.CopyTo(arr, 0);
            return arr;
#else
            return Enum.GetValues(enumType);
#endif
        }

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Pass typeof(SomeEnum) — a Type whose IsEnum is true
  2. Guard with type.IsEnum before calling GetEnumValues
  3. Use Enum.GetValues directly when full-framework APIs are available
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/util/Enums.cs:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/ed0269189bc6008c. Report an issue: GitHub.