Skip to content

CC0068 Triggers on static async Task for console main application #1041

@nonsensesoftware

Description

@nonsensesoftware

Starting with C# 7.1 features, a Main method (the entry point for an application) can be declared as async, and can return a Task. CC0068 incorrectly triggers stating that this method should be removed because it is unused. However, you cannot remove the Main method for an application otherwise it would not compile or run.

Coincidentally, if I change the Main method from async Task to just void Main, the rule does not get triggered as I would expect.

static async Task Main(string[] args)
{
    //Do something here
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions