dotnet/roslyn

IDE0059

开放

#52,248 创建于 2021年3月30日

 (1 条评论) (0 个反应) (1 位负责人)C# (4,257 个派生)batch import
Area-IDEBugFeature - IDE0059help wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

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

贡献者指南