build(deps): adopt NSubstitute 6.0.0 and fix new nullability annotations (#354)#361
Merged
Conversation
…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
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
NSubstitute 6.0.0 tightens its nullability annotations:
Arg.Is<T>(x => …)now hands the predicate a nullablex, andCallInfo.Arg<T>()returnsT?. 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
NSubstitute5.3.0→6.0.0in the four projects that declare it:Proxytrace.Testing,Proxytrace.Licensing.Tests,perf/Proxytrace.PerfHarness,perf/Proxytrace.Benchmarks.!-suppression (banned repo-wide):Arg.Is<T>(x => …)predicates guarded withx != null && …. The predicate is an expression tree, sois not nullis illegal there (CS8122) —!= nullis the correct form.CallInfo.Arg<T>()values asserted withArgumentNullException.ThrowIfNull(arg)before they feed a non-null sink (echoing back insideTask<T>,List.Add,TrySetResult,Func.Invoke). A plainstring?echo through.Returnsneeds no guard — v6 relaxes the callback return — so only nested-generic / non-Returnssinks were touched.testskill (.claude/skills/test/SKILL.md) and updated its now-staleAddAsyncecho example.Verification
dotnet build Proxytrace.sln— succeeds, zero warnings; bothperf/projects build too.Follow-up
The
@dependabot ignoreon 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 unignoreso future 6.x updates flow normally.🤖 Generated with Claude Code
Generated by Claude Code