False positive S1144 it thinks a nested class is not used

csharp

(David Kantrowitz) #1

Using SonarLint for Visual Studio 2017 version 4.1.0.3539, with Visual Studio Professional 2017 Version 15.7.3
Created a .NET Core 2.0 Console App with the following code (just 1 file). It flags “internal static class Factory” with “S1144 Remove the unused internal type ‘Factory’.”

using System;

namespace TestApp
{
    internal static class Program
    {
        static void Main(string[] args)
        {
            var retriever = Retriever.Factory.CreateRetriever();
            Console.WriteLine(retriever.Retrieve());
        }
    }

    internal class Retriever
    {
        internal static class Factory
        {
            public static Retriever CreateRetriever()
            {
                return new Retriever();
            }
        }

        internal string Retrieve()
        {
            return "Results";
        }
    }
}

(Amaury Levé) #2

Hi @DavidKantrowitz,

Thank you for the feedback! You can check the progress of the fix here.

Cheers,
Amaury