roslyn: C# compiler does not provide a warning about unused lambda variables

For the code:

    void SomeMethod()
    {
        void localFunction()
        {
        }

        Func<int> lambda = () =>
        {
            return 1;
        };
    }

compiler provides a warning for the unused local function but does not for the unused lambda. I expect they should be consistent. Those compiler diagnostics is used in roslyn-analyzers.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (22 by maintainers)

Most upvoted comments

@agocke We’re targeting warning waves to release along with C# 8.0.