dotnet/roslyn

IDE0059 - Unneccessary assignment is not reported if lambda is used in method

Aberta

#38.376 aberto em 29 de ago. de 2019

 (0 comentário) (4 reações) (0 responsável)C# (4.257 forks)batch import
Area-IDEConcept-Continuous ImprovementFeature - IDE0059IDE-CodeStylehelp wanted

Métricas do repositório

Stars
 (20.414 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

Version Used: VS16.3 Preview 2

Steps to Reproduce:

using System;

namespace TestNamespace
{
    public class TestClass
    {
        public void TestMethod()
        {
            var r = new Random();
            DoSmth(() => true);
        }

        private void DoSmth(Func<bool> func) => func();
    }
}

Expected Behavior: IDE0059 should be triggered for r.

Actual Behavior: IDE0059 is not triggered. If you comment out DoSmth(() => true);, IDE0059 is triggered as expected.

Guia do colaborador