Skip to content

Remove Shouldly from ProjectCachePlugin sample#13219

Open
Copilot wants to merge 2 commits intomainfrom
copilot/remove-shouldly-reference
Open

Remove Shouldly from ProjectCachePlugin sample#13219
Copilot wants to merge 2 commits intomainfrom
copilot/remove-shouldly-reference

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Context

The ProjectCachePlugin sample uses Shouldly (a test assertion library) in production code solely to null-check buildRequest.ProjectInstance. This is an unnecessary dependency for a simple precondition check.

Changes Made

  • Replace ShouldNotBeNull() with a plain is null check throwing InvalidOperationException
  • Remove using Shouldly; and the Shouldly PackageReference from the project

Testing

Build succeeds with 0 warnings, 0 errors. Behavior is identical — null ProjectInstance still throws with the same message.

Notes

Original prompt

It's silly to use an assertion library in this code just to throw an exception if something is null. Rewrite to equivalent functionality and drop the Shouldly reference from the project file.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dotnet-policy-service
Copy link
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

@rainersigwald rainersigwald mentioned this pull request Feb 6, 2026
…n sample and remove Shouldly package reference

Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove Shouldly reference and replace assertions Remove Shouldly from ProjectCachePlugin sample Feb 6, 2026
Copilot AI requested a review from rainersigwald February 6, 2026 23:02
@rainersigwald rainersigwald marked this pull request as ready for review February 6, 2026 23:08
Copilot AI review requested due to automatic review settings February 6, 2026 23:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the Shouldly assertion library from the ProjectCachePlugin sample by replacing its only usage (a null-check on buildRequest.ProjectInstance) with a standard runtime guard and by dropping the Shouldly PackageReference.

Changes:

  • Replaced ShouldNotBeNull(...) with an explicit is null check that throws InvalidOperationException
  • Removed using Shouldly; from the sample implementation
  • Removed the Shouldly PackageReference from the sample project file

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Samples/ProjectCachePlugin/ProjectCachePlugin.csproj Removes the unused Shouldly dependency from the sample project.
src/Samples/ProjectCachePlugin/AssemblyMockCache.cs Replaces the Shouldly assertion with a standard null-check + exception.

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.

3 participants

Comments