The following method generates warning S4457 because it contains synchronous parameter validation. However, it can’t be changed to the recommended pattern because it is overriding an async method in the base class.
public override async Task Invoke(IOwinContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
//Do async stuff here...
}
EDIT: Sorry, ignore this, async keyword can still be removed and then the pattern followed.