S4457 should not fire when overriding an async method


(Paul Hickman) #1

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.

(Amaury Levé) #2

Hi @paulhickman,

Glad to see you figured it out :smiley: