π― Repository Quality Improvement Report β Roslyn Analyzer Suppression Hygiene
Analysis Date: 2026-08-17 | Strategy Type: Custom
Executive Summary
The codebase contains 297 #pragma warning disable directives (238 in src/) and ~40 SuppressMessage/NoWarn entries. Most are justified, but five categories are actionable:
- Global
CA1416 suppression in Directory.Build.props silences all platform-compatibility warnings repo-wide β vstest is cross-platform, so this hidden safety net is dangerous.
- 11 CS8618 suppressions in
[DataContract] serialization constructors that can be removed using C# 11 required modifier or nullable field annotations.
- 2 IDE0060 suppressions tagged with explicit
TODO comments that were never resolved.
TestServiceLocator.cs β #if DEBUG scaffolding with RS0016+RS0037 suppressions and stale TODOs leaked into the ObjectModel NuGet's debug build.
- Global
RS0037 suppression means PublicAPI.Shipped.txt entries across all projects lack nullability annotations.
π€ Suggested Improvement Tasks
Task 1: Remove global CA1416 suppression; add per-callsite platform guards
Priority: High | Effort: Medium
Remove CA1416 from Directory.Build.props line 39 (<NoWarn>$(NoWarn);CA1416;RS0037</NoWarn>). Rebuild; annotate each reported violation with [SupportedOSPlatform("windows")] or guard with if (OperatingSystem.IsWindows()).
Task 2: Replace CS8618 pragma blocks with required or nullable annotations
Priority: High | Effort: Medium
All 11 suppressions follow the DataContract parameterless-constructor pattern. Apply C# 11 required modifier to fields that must be set, or change field type to nullable where they are genuinely optional. Affected files include TestCase.cs, TestProperty.cs, Framework.cs, DiscoveryCriteria.cs, TestRunCompleteEventArgs.cs, TestRunStatistics.cs, DataCollectionEventArgs.cs, TestCaseEvents.cs, and DataCollectionEnvironmentContext.cs.
Task 3: Resolve two stale TODO + IDE0060 suppressions
Priority: Medium | Effort: Small
TestRequestSender.cs:850 β ConvertToAttachDebuggerInfo has unused message and protocolVersion parameters. The comment says "There is nothing to do differently based on those versions." Remove the unused parameters and update call sites.
VersionAttribute.cs β Store the unused version parameter: public int Version { get; } = version; β eliminates both the pragma and the TODO.
Task 4: Delete or graduate TestServiceLocator.cs
Priority: Medium | Effort: Small
src/Microsoft.TestPlatform.ObjectModel/TestServiceLocator.cs is #if DEBUG-only scaffolding shipping in the ObjectModel NuGet debug build. It suppresses RS0016 and RS0037, and carries two unresolved TODOs (// TODO: Make this internal, // TODO: Add enable flag). Either convert it to a proper internal service locator with tests, or delete it.
Task 5: Per-project RS0037 remediation starting with ObjectModel
Priority: Low | Effort: Large
Remove the global RS0037 suppression from Directory.Build.props incrementally by enabling it per project. Start with Microsoft.TestPlatform.ObjectModel β annotate PublicAPI.Shipped.txt entries with ? where applicable. This makes the public API tracker fully exploit C# nullability.
π Historical Context (last 5 runs)
| Date |
Focus Area |
Type |
| 2026-08-14 |
argument-validation-consistency-and-modern-guard-adoption |
Custom |
| 2026-08-13 |
test-asset-project-hygiene-centralized-property-adoption |
Custom |
| 2026-08-12 |
reflection-anti-patterns-private-setter-bypass |
Custom |
| 2026-08-11 |
conditional-compilation-dead-code-and-legacy-symbol-hygiene |
Custom |
| 2026-08-10 |
permanently-ignored-test-coverage-debt |
Custom |
Next analysis: 2026-08-18
Generated by Repository Quality Improver Β· 54.6 AIC Β· β 6.53 AIC Β· β 8.9K Β· β·
π― Repository Quality Improvement Report β Roslyn Analyzer Suppression Hygiene
Analysis Date: 2026-08-17 | Strategy Type: Custom
Executive Summary
The codebase contains 297
#pragma warning disabledirectives (238 insrc/) and ~40SuppressMessage/NoWarnentries. Most are justified, but five categories are actionable:CA1416suppression inDirectory.Build.propssilences all platform-compatibility warnings repo-wide β vstest is cross-platform, so this hidden safety net is dangerous.[DataContract]serialization constructors that can be removed using C# 11requiredmodifier or nullable field annotations.TODOcomments that were never resolved.TestServiceLocator.csβ#if DEBUGscaffolding with RS0016+RS0037 suppressions and stale TODOs leaked into the ObjectModel NuGet's debug build.RS0037suppression meansPublicAPI.Shipped.txtentries across all projects lack nullability annotations.π€ Suggested Improvement Tasks
Task 1: Remove global CA1416 suppression; add per-callsite platform guards
Priority: High | Effort: Medium
Remove
CA1416fromDirectory.Build.propsline 39 (<NoWarn>$(NoWarn);CA1416;RS0037</NoWarn>). Rebuild; annotate each reported violation with[SupportedOSPlatform("windows")]or guard withif (OperatingSystem.IsWindows()).Task 2: Replace CS8618 pragma blocks with
requiredor nullable annotationsPriority: High | Effort: Medium
All 11 suppressions follow the DataContract parameterless-constructor pattern. Apply C# 11
requiredmodifier to fields that must be set, or change field type to nullable where they are genuinely optional. Affected files includeTestCase.cs,TestProperty.cs,Framework.cs,DiscoveryCriteria.cs,TestRunCompleteEventArgs.cs,TestRunStatistics.cs,DataCollectionEventArgs.cs,TestCaseEvents.cs, andDataCollectionEnvironmentContext.cs.Task 3: Resolve two stale TODO + IDE0060 suppressions
Priority: Medium | Effort: Small
TestRequestSender.cs:850βConvertToAttachDebuggerInfohas unusedmessageandprotocolVersionparameters. The comment says "There is nothing to do differently based on those versions." Remove the unused parameters and update call sites.VersionAttribute.csβ Store the unusedversionparameter:public int Version { get; } = version;β eliminates both the pragma and the TODO.Task 4: Delete or graduate TestServiceLocator.cs
Priority: Medium | Effort: Small
src/Microsoft.TestPlatform.ObjectModel/TestServiceLocator.csis#if DEBUG-only scaffolding shipping in the ObjectModel NuGet debug build. It suppresses RS0016 and RS0037, and carries two unresolved TODOs (// TODO: Make this internal,// TODO: Add enable flag). Either convert it to a proper internal service locator with tests, or delete it.Task 5: Per-project RS0037 remediation starting with ObjectModel
Priority: Low | Effort: Large
Remove the global
RS0037suppression fromDirectory.Build.propsincrementally by enabling it per project. Start withMicrosoft.TestPlatform.ObjectModelβ annotatePublicAPI.Shipped.txtentries with?where applicable. This makes the public API tracker fully exploit C# nullability.π Historical Context (last 5 runs)
Next analysis: 2026-08-18