dotnet/roslyn

IDE0059

オープン

#52,248 opened on 2021/03/30

 (1 件のコメント) (0 件のリアクション) (1 人の担当者)C# (4,257 件のフォーク)batch import
Area-IDEBugFeature - IDE0059help wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

Version Used: Visual Studio 2019 v16.8.1 dotnet --list-sdks: 5.0.100 , 5.0.104 csproj.TargetFramework: netcoreapp3.1 or net5.0 csproj.LangVersion: latest

Steps to Reproduce:

public bool Func1()
{
    bool retry = true;
    while (true)
    {
        //...

        try
        {
            var model = new Class1
            {
                FieldOrProperty = 1 //The error disappears, if this line is deleted !
            };
            //...
            return true;
        }
        catch
        {
            //...
        }

        if (!retry) return false;
        retry = false; //IDE0059: Unnecessary assignment of a value to 'retry'
        //...
    }
}

Expected Behavior: No IDE0059

Actual Behavior: IDE0059

コントリビューターガイド