public static bool IsControllerAction(IMethodSymbol method, IMethodSymbol disposableDispose) { method = method ?? throw new ArgumentNullException(nameof(method)); if (method.MethodKind != MethodKind.Ordinary) { return(false); } if (method.IsStatic) { return(false); } if (method.IsAbstract) { return(false); } if (method.IsGenericMethod) { return(false); } if (method.DeclaredAccessibility != Accessibility.Public) { return(false); } // Overridden methods from Object class, e.g. Equals(Object), GetHashCode(), etc., are not valid. if (method.GetDeclaringType().SpecialType == SpecialType.System_Object) { return(false); } if (IsIDisposableDispose(method, disposableDispose)) { return(false); } if (method.GetAttributes(inherit: true).Any(attr => attr.AttributeClass.GetFullNamespacedName() == "Microsoft.AspNetCore.Mvc.NonActionAttribute")) { return(false); } return(true); }