Skip to content

build(deps): adopt NSubstitute 6.0.0 and fix new nullability annotations (#354)#361

Merged
JabbaKadabra merged 1 commit into
masterfrom
claude/issue-354-2izpim
Jul 12, 2026
Merged

build(deps): adopt NSubstitute 6.0.0 and fix new nullability annotations (#354)#361
JabbaKadabra merged 1 commit into
masterfrom
claude/issue-354-2izpim

Conversation

@JabbaKadabra

Copy link
Copy Markdown
Collaborator

Summary

NSubstitute 6.0.0 tightens its nullability annotations: Arg.Is<T>(x => …) now hands the predicate a nullable x, and CallInfo.Arg<T>() returns T?. Under the repo's warnings-as-errors this broke the test build, which is why the #347 bump was @dependabot ignored and we stayed pinned to 5.3.0. This bumps the package in all four consuming projects and fixes every diagnostic site so the solution builds green — unblocking future NSubstitute updates (including security patches).

Closes #354

Changes

  • Bumped NSubstitute 5.3.06.0.0 in the four projects that declare it: Proxytrace.Testing, Proxytrace.Licensing.Tests, perf/Proxytrace.PerfHarness, perf/Proxytrace.Benchmarks.
  • Fixed all resulting nullability diagnostics across the test projects without !-suppression (banned repo-wide):
    • Arg.Is<T>(x => …) predicates guarded with x != null && …. The predicate is an expression tree, so is not null is illegal there (CS8122) — != null is the correct form.
    • Captured CallInfo.Arg<T>() values asserted with ArgumentNullException.ThrowIfNull(arg) before they feed a non-null sink (echoing back inside Task<T>, List.Add, TrySetResult, Func.Invoke). A plain string? echo through .Returns needs no guard — v6 relaxes the callback return — so only nested-generic / non-Returns sinks were touched.
  • Documented the v6 convention in the test skill (.claude/skills/test/SKILL.md) and updated its now-stale AddAsync echo example.

Verification

  • build: dotnet build Proxytrace.sln — succeeds, zero warnings; both perf/ projects build too.
  • tests: ran every modified test class — 238 passed, 0 failed (Api 56, Application 114, Domain 18, Infrastructure 37, Messaging 3, Proxy 10).
  • docs/changelog: test skill updated. No CHANGELOG entry — NSubstitute is a test-only dependency, never shipped, so the change is not user-facing.

Follow-up

The @dependabot ignore on the NSubstitute 6.x major (from #347) still stands. This PR takes the version directly; once merged, the ignore rule can be lifted with @dependabot unignore so future 6.x updates flow normally.

🤖 Generated with Claude Code


Generated by Claude Code

…notations

NSubstitute 6 annotates its API as nullable-aware. Under the repo's
warnings-as-errors, `Arg.Is<T>(x => …)` now hands the predicate a nullable
`x`, and `CallInfo.Arg<T>()` returns `T?` — which broke the test build and
kept us pinned to 5.3.0 (the #347 bump was ignored until this was done).

Fix each diagnostic site genuinely (no `!` — banned repo-wide):
- guard `Arg.Is` predicates with `x != null && …` (expression trees forbid
  the `is` operator, so `is not null` is not usable there)
- assert captured `CallInfo.Arg<T>()` values with
  `ArgumentNullException.ThrowIfNull` before feeding them to non-null sinks
  (Task<T> echoes, list adds, TrySetResult)

Bump the package in all four consuming projects (Testing, Licensing.Tests,
and the two perf projects) and document the v6 convention in the test skill.

Refs #354

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141wRxb7AGPBZcfsC4Jym6k
@JabbaKadabra
JabbaKadabra merged commit eca1061 into master Jul 12, 2026
7 checks passed
@JabbaKadabra
JabbaKadabra deleted the claude/issue-354-2izpim branch July 12, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NSubstitute 6 requires test-code changes for its new nullability annotations — bump blocked until then

2 participants