dotnet/roslyn

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

開放

#38,376 建立於 2019年8月29日

 (0 則留言) (4 個反應) (0 位負責人)C# (4,257 個分叉)batch import
Area-IDEConcept-Continuous ImprovementFeature - IDE0059IDE-CodeStylehelp wanted

倉庫指標

星標
 (20,414 顆星)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 256 個 PR)

描述

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.

貢獻者指南