Skip to main content

CRR0013 - The member always returns the same value

This analyzer detects members which return the same value.

public bool Test(bool condition) {
    if (condition)
        return false;
    return false;
}

How to Fix the Issue

Change the method’s return statement.

public bool Test(bool condition) {
    if (condition)
        return false;
    return true;
}

How to Enable the Diagnostic

Choose the Member always returns the same value issue in the Editor | Language | Code Analysis | Code Issues Catalog options page and check the Enabled checkbox.

Enable