fix: MA0002 ordinal comparisons and CS8602 nullable derefs - #569
Merged
Conversation
Bumps AngleSharp from 1.5.0 to 1.7.0 Bumps AWSSDK.SecretsManager from 4.0.100.5 to 4.0.100.7 Bumps bunit from 2.7.2 to 2.8.6 Bumps dotnet-reportgenerator-globaltool from 5.5.10 to 5.5.11 Bumps JD.SemanticKernel.Connectors.ClaudeCode from 1.0.44 to 1.0.48 Bumps JD.SemanticKernel.Connectors.GitHubCopilot from 0.1.74 to 0.1.78 Bumps JD.SemanticKernel.Connectors.OpenAICodex from 0.1.40 to 0.1.45 Bumps JD.SemanticKernel.Extensions from 0.1.113 to 0.1.117 Bumps JD.SemanticKernel.Extensions.Mcp from 0.1.113 to 0.1.117 Bumps jetbrains.resharper.globaltools from 2026.1.4 to 2026.2.0.1 Bumps Meziantou.Analyzer from 3.0.123 to 3.0.138 Bumps NSubstitute from 5.3.0 to 6.0.0 Bumps StackExchange.Redis from 3.0.17 to 3.1.0 Bumps Telegram.Bot from 22.10.2 to 22.10.2.1 Bumps TinyBDD.Xunit from 0.19.29 to 0.19.31 Bumps WorkflowFramework from 1.0.4 to 1.0.5 --- updated-dependencies: - dependency-name: AngleSharp dependency-version: 1.7.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nuget-dependencies - dependency-name: AWSSDK.SecretsManager dependency-version: 4.0.100.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: bunit dependency-version: 2.8.6 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nuget-dependencies - dependency-name: dotnet-reportgenerator-globaltool dependency-version: 5.5.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: JD.SemanticKernel.Connectors.ClaudeCode dependency-version: 1.0.48 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: JD.SemanticKernel.Connectors.GitHubCopilot dependency-version: 0.1.78 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: JD.SemanticKernel.Connectors.OpenAICodex dependency-version: 0.1.45 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: JD.SemanticKernel.Extensions dependency-version: 0.1.117 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: JD.SemanticKernel.Extensions.Mcp dependency-version: 0.1.117 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: jetbrains.resharper.globaltools dependency-version: 2026.2.0.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nuget-dependencies - dependency-name: Meziantou.Analyzer dependency-version: 3.0.138 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: NSubstitute dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: nuget-dependencies - dependency-name: StackExchange.Redis dependency-version: 3.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nuget-dependencies - dependency-name: Telegram.Bot dependency-version: 22.10.2.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: TinyBDD.Xunit dependency-version: 0.19.31 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies - dependency-name: WorkflowFramework dependency-version: 1.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nuget-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
Meziantou.Analyzer 3.0.138 (was 3.0.12x) enforces MA0002, requiring explicit StringComparer/StringComparison on string comparison APIs. NSubstitute 6.0.0 (was 5.3.0) added nullable reference annotations to Arg.Is<T>/Arg.Any<T> predicate parameters and CallInfo.Arg<T>(), surfacing latent CS8602/CS8604 nullable-dereference warnings across test mocks that are now promoted to errors under CI's TreatWarningsAsErrors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
Code Coverage |
Contributor
Test Results7 641 tests 7 622 ✅ 2m 28s ⏱️ Results for commit 8fa63ff. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR bundles the same 16 NuGet package bumps as #568 (Meziantou.Analyzer, NSubstitute, bunit, AWSSDK.SecretsManager, StackExchange.Redis, JD.SemanticKernel.* connectors, etc.) plus the fixes required for the resulting build breakage, so it can merge standalone and unblock #568 to rebase cleanly.
Root cause 1 — MA0002 (80 sites, 32 files)
Meziantou.Analyzer3.0.12x → 3.0.138 enforces MA0002: string-comparison APIs (Assert.Contains,Assert.NotEqual,OrderDescending, etc. overIEnumerable<string>) must specify an explicitIEqualityComparer<string>/IComparer<string>. Fixed by addingStringComparer.Ordinalat each flagged call site — this is behavior-preserving since it matches .NET's default ordinal semantics forContains/equality; the one exception isCheckpointingSteps.cs'scpDirs.OrderDescending(), where the previous default was culture-sensitive ordering (viastring.CompareTo), so switching toStringComparer.Ordinalis technically a (safe, deterministic) semantic change, called out here for visibility.Root cause 2 — CS8602 / CS8604 (42 + 1 sites, 15 files) — CONFIRMED NSubstitute 6.0.0
NSubstitute5.3.0 → 6.0.0 added nullable reference annotations toArg.Is<T>/Arg.Any<T>predicate parameters andCallInfo.Arg<T>(), so lambda parameters and captured mock arguments that were implicitly non-null before are nowT?, surfacing real (if practically unreachable) CS8602/CS8604 warnings that CI'sTreatWarningsAsErrors(set only whenCI=true, matching GitHub Actions) promotes to build errors. Verified directly: e.g.Arg.Is<Type>(t => t.IsGenericType ...)andcallInfo.Arg<SubagentConfig>().Name— both APIs from NSubstitute, both newly nullable.Fix approach, in order of preference per site:
.Returns(callInfo => { ... })) — addedAssert.NotNull(config)(xUnit) orx.Should().NotBeNull()(FluentAssertions, matching each file's existing style) immediately after capturing the mock argument, before use. ~15 sites.Arg.Is<T>(x => x.Foo == ...)) — used the null-forgiving operatorx!on first use, since restructuring a matcher predicate into a block body just to assert would be invasive and semantically odd (an assert throwing during argument-matching, rather than at the normal test-failure point). ~28 sites.One CS8604 site (
MultiTurnExecutorTests.cs:324,new ChatHistory(history)wherehistory = callInfo.Arg<ChatHistory>()) is the same root cause manifesting as a different diagnostic code; fixed identically withhistory.Should().NotBeNull(). Confirmed via a baseline build ofmain(pre-bump) withCI=true: zero MA0002/CS8602/CS8604 anywhere — all of this is 100% attributable to the bump.Verification
dotnet build -c Release(withCI=true, matching GitHub Actions' default env, which is what actually turns these into build-breaking errors): 0 warnings, 0 errors.dotnet test -c Release: all suites pass except two pre-existing, unrelated flaky/environmental failures, confirmed present on the unmodified bump branch before this fix (i.e., not introduced by it):JD.AI.Tests.Workflows.MlNetIntentClassifierTests(~10-11 of many parameterized cases, count varies run-to-run) — ML.NET intent-classifier confidence-threshold flakiness, unrelated to any file touched here.JD.AI.E2E.Tests.SessionScenarioTests.GetAuditEvents_ReturnsOk— requires external service state.Files touched
47 test files only (no production/
srccode touched) — see diff for the full list. No refactoring, formatting, or unrelated cleanup; every change is either, StringComparer.Ordinal/, StringComparer.Ordinal)added to an existing call, or a null-forgiving!/Assert.NotNull/.Should().NotBeNull()guard added immediately before a now-nullable-annotated NSubstitute value is dereferenced.Unblocks #568 — once this merges, #568 can rebase cleanly onto a green
main.Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com