Skip to content

Rename the misnamed NUnit VerifyBase.ThrowsValueTask<T> overload - #1886

Merged
SimonCropp merged 1 commit into
mainfrom
fix-nunit-throws-task-name
Aug 29, 2026
Merged

Rename the misnamed NUnit VerifyBase.ThrowsValueTask<T> overload#1886
SimonCropp merged 1 commit into
mainfrom
fix-nunit-throws-task-name

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

VerifyBase declared ThrowsValueTask(Func<Task>), which forwards to Verifier.ThrowsTask. The name was a copy paste error: the static API and MSTest's VerifyBase both call this ThrowsTask.

So NUnit's VerifyBase had no generic ThrowsTask at all, and ThrowsValueTask was overloaded across unrelated Task and ValueTask signatures. Code moved between the static and instance APIs, or from MSTest, did not compile against the name it expected.

Renamed rather than kept alongside an obsolete forwarder, since a forwarder would preserve the overload confusion that is the actual problem here. Callers of the old name change to ThrowsTask, which is the method they were already reaching.

VerifyBase declared ThrowsValueTask<T>(Func<Task<T>>), which forwards to
Verifier.ThrowsTask. The name was a copy paste error: the static API and
MSTest's VerifyBase both call this ThrowsTask<T>.

So NUnit's VerifyBase had no generic ThrowsTask at all, and ThrowsValueTask was
overloaded across unrelated Task<T> and ValueTask<T> signatures. Code moved
between the static and instance APIs, or from MSTest, did not compile against
the name it expected.

Renamed rather than kept alongside an obsolete forwarder, since a forwarder
would preserve the overload confusion that is the actual problem here. Callers
of the old name change to ThrowsTask, which is the method they were already
reaching.
@SimonCropp SimonCropp added this to the 33.0.0 milestone Aug 29, 2026
@SimonCropp
SimonCropp merged commit 39f4900 into main Aug 29, 2026
7 checks passed
@SimonCropp
SimonCropp deleted the fix-nunit-throws-task-name branch August 29, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant