Background
A full rebuild of Lite produces 190 unique warnings (380 raw — each fires twice because WPF compiles XAML through a temp project). Counts for Dashboard and Installer haven't been audited yet but likely have similar profiles.
Lite breakdown
| Code |
Unique count |
Description |
Verdict |
| CA1873 |
184 |
""Evaluation of this argument may be expensive and unnecessary if logging is disabled"" — fires on every _logger?.LogXxx(""…"", someField) call |
Noise. The analyzer flags any non-literal argument. Real fix is LoggerMessage.Define source generators (big refactor) or if (_logger.IsEnabled(level)) wrappers (ugly). Suppress globally — the ""expense"" of a field access is negligible. |
| CS8604 |
2 |
""Possible null reference argument"" at Lite/Controls/CorrelatedTimelineLanesControl.xaml.cs:178,182 — passing a nullable collection to .Select(...) |
Real. Fix with null-coalesce or guard. |
| CA1859 |
1 |
""Change return type from object? to Dictionary<string, object>? for performance"" at Lite/Mcp/McpAnalysisTools.cs:843 |
Real. Concrete return type avoids boxing. |
Proposed approach
- Add a project-root
.editorconfig (or extend an existing one) that suppresses CA1873 with a justification comment.
- Fix the three real warnings in Lite (CS8604 ×2, CA1859 ×1).
- Run the same audit on Dashboard and Installer; fix what's real, suppress what isn't.
- Verify
dotnet build reports 0 warnings on all three projects.
Suppression should be global via .editorconfig, not per-file #pragma warning disable, so future code stays clean.
Out of scope
- Migrating to
LoggerMessage.Define / source-generator logging (separate, larger effort).
- Treating warnings as errors. We can revisit
TreatWarningsAsErrors once the count is at zero.
Background
A full rebuild of Lite produces 190 unique warnings (380 raw — each fires twice because WPF compiles XAML through a temp project). Counts for Dashboard and Installer haven't been audited yet but likely have similar profiles.
Lite breakdown
_logger?.LogXxx(""…"", someField)callLoggerMessage.Definesource generators (big refactor) orif (_logger.IsEnabled(level))wrappers (ugly). Suppress globally — the ""expense"" of a field access is negligible.Lite/Controls/CorrelatedTimelineLanesControl.xaml.cs:178,182— passing a nullable collection to.Select(...)object?toDictionary<string, object>?for performance"" atLite/Mcp/McpAnalysisTools.cs:843Proposed approach
.editorconfig(or extend an existing one) that suppresses CA1873 with a justification comment.dotnet buildreports 0 warnings on all three projects.Suppression should be global via
.editorconfig, not per-file#pragma warning disable, so future code stays clean.Out of scope
LoggerMessage.Define/ source-generator logging (separate, larger effort).TreatWarningsAsErrorsonce the count is at zero.