dotnet/roslyn

IDE0059

Aberta

#52.248 aberto em 30 de mar. de 2021

 (1 comentário) (0 reação) (1 responsável)C# (4.257 forks)batch import
Area-IDEBugFeature - IDE0059help 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: 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

Guia do colaborador