The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
V19.2
19.2
19.1
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

CRR0044 - Unused local variable

This analyzer detects variables that are never used in your code and can be deleted.

class RemoveVariable {
    BlockSyntax GetGetterBody(IMemberDescriptor field) {
        var statementsList = new List<StatementSyntax>();
        return SyntaxFactory.Block(new StatementSyntax[] { FieldToReturnStatement(field) });
    }
}

To fix the issue, remove the unused variable:

class RemoveVariable {
    BlockSyntax GetGetterBody(IMemberDescriptor field) {
        return SyntaxFactory.Block(new StatementSyntax[] { FieldToReturnStatement(field) });
    }
}

Call one of the Remove Variable, Remove Variable with its Initializer, and Remove Discard Variable refactorings to remove the unused variable from your code. To do it in different places at once, use the Code Cleanup feature with the Remove unused variables rule enabled.