Skip to content

Remove Shouldly from ProjectCachePlugin sample#13219

Merged
JanProvaznik merged 3 commits intomainfrom
copilot/remove-shouldly-reference
Feb 24, 2026
Merged

Remove Shouldly from ProjectCachePlugin sample#13219
JanProvaznik merged 3 commits intomainfrom
copilot/remove-shouldly-reference

Conversation

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@JanProvaznik JanProvaznik enabled auto-merge (squash) February 24, 2026 13:02
@JanProvaznik JanProvaznik merged commit 28e6097 into main Feb 24, 2026
10 checks passed
@JanProvaznik JanProvaznik deleted the copilot/remove-shouldly-reference branch February 24, 2026 13:58
JanProvaznik pushed a commit to JanProvaznik/msbuild that referenced this pull request Feb 25, 2026
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
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.

5 participants