Skip to main content

CRR0014 - The variable is assigned twice in succession

This analyzer detects variables which receive two assignments in succession.

bool isSelected = false;
isSelected = true; 

How to Fix the Issue

Remove the first assignment.

bool isSelected;
isSelected = true; 

How to Enable the Diagnostic

Choose Variable is assigned twice in succession in the Editor | Language | Code Analysis | Code Issues Catalog options page and check the Enabled checkbox.