Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S1144: False positive on async Main #888

Closed
nnpcYvIVl opened this issue Oct 27, 2017 · 5 comments · Fixed by #1025
Closed

Fix S1144: False positive on async Main #888

nnpcYvIVl opened this issue Oct 27, 2017 · 5 comments · Fixed by #1025
Assignees
Labels
Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@nnpcYvIVl
Copy link

A false positive S1144 is thrown on the line:

static async Task Main(string[] args)

In C# 7.1 this is a valid entrypoint method. https://blogs.msdn.microsoft.com/mazhou/2017/05/30/c-7-series-part-2-async-main/

using System;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("Test");
        }
    }
}
@valhristov valhristov changed the title SonarLint S1144 False Positive Fix S1144: False positive on async Main Oct 30, 2017
@valhristov
Copy link
Contributor

Hi @nnpcYvIVl, thanks for the feedback, we will fix this issue once we start working on C# 7 in the near future.

@RowlandShaw
Copy link

I've started seeing this again with version 4.5.0.3786

@valhristov
Copy link
Contributor

Hi @RowlandShaw, is the project you are seeing this error connected to a SonarQube instance? If yes, even with the latest SonarLint, you could be using the analyzers which are installed on SonarQube.

Could you please check if you have SonarAnalyzer.CSharp nuget package referenced in your project. If yes, what's its version?

If you are not connected, or if you are using the latest version, could you please send us a simple reproducer application, because we are unable to see issues with the code snippet in the original ticket.

@RowlandShaw
Copy link

One thing I did notice was making the class static resolved the issue

@valhristov
Copy link
Contributor

Hi @RowlandShaw, I am unable to reproduce the problem with the latest version of SonarC#, could you please open a new issue and provide a simple code snippet that triggers the rule? Thank you in advance!

@ghost ghost removed the Status: Todo label Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants