Skip to content

Rule Idea: void method implementations should not be async #9711

Open
@Tim-Pohlmann

Description

interface IInterface
{
    void InterfaceMethod();
}

class Base
{
    protected virtual void BaseMethod() {}
}

class Sample : Base, IInterface
{
    public async void InterfaceMethod() {}           // Noncompliant 
    protected override async void BaseMethod() {}    // Noncompliant
    protected virtual async void VirtualMethod() {}  // Noncompliant
    async void OtherMethod() {}                      // Compliant: covered by S3168
}

This rule complements S3168, which ignores methods that implement an interface, override a base method, or are virtual. Having this functionality as a separate rule allows users to tailor their analysis to their needs.

Metadata

Assignees

No one assigned

    Labels

    Area: C#C# rules related issues.Type: Rule IdeaIdea for a rule that has NOT been specified.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions