Unassigned Variable Usage
Warns when a variable is referenced prior to being assigned.
NEW! This inspection is only available in pre-release builds.
Remarks
This inspection may produce false positives when the variable is an array, or if it's passed by reference (ByRef) to a procedure that assigns it.
Reasoning
An uninitialized variable is being read, but since it's never assigned, the only value ever read would be the data type's default initial value. Reading a variable that was never written to in any code path (especially if Option Explicit isn't specified), is likely to be a bug.
Default severity
Error
Inspection type
CodeQualityIssues
QuickFixes
The following quickfixes are available for this inspection:
Examples
This example should trigger a result
This example should NOT trigger a result
Rubberduck.CodeAnalysis.Inspections.Concrete.UnassignedVariableUsageInspection.cs (Prerelease-v2.5.2.6174)