ardalis / ardalis/GuardClauses
Package Release 4.6 update causes Runtime breaking change: Missing Method Exception
- Dominant language
- C#
- Stars
- 3.3k
- Forks
- 296
- PR merge metrics
- No merged PRs in 30d
Description
### Environment
- Windows 22H2
- .NET SDK Version: 8.07
### Subject of the issue
Where there is a hierarchy of code that use `Ardalis.GuardClauses` updating the top level package, without updating the tranisitive library package to use the same version complies without error, but throws `System.MissingMethodException : Method not found: 'System.String Ardalis.GuardClauses.GuardClauseExtensions.NullOrEmpty(Ardalis.GuardClauses.IGuardClause, System.String, System.String, System.String)'.`
### Steps to Reproduce:
1. Update top-level package in client solution from v4.5 to v4.6
2. Version 4.5 remaining in library packages
3. Run application or tests
4. Exception is thrown when guard clause is called.
### Expected behaviour
Update to top-level package should not cause runtime exception where no changes have been made to top-level code.
### Actual behaviour
Calls to guard clauses throw:
```
System.MissingMethodException : Method not found: 'System.String Ardalis.GuardClauses.GuardClauseExtensions.NullOrEmpty(Ardalis.GuardClauses.IGuardClause, System.String, System.String, System.String)'.
```
### Tested resolution
Updating all libraries using the package to version 4.6 resolved the issue, as did reverting top-level package to 4.5 or removing top-level package and using transitive.
Contributor guide
Research direction
Start by reproducing the package hierarchy described: use Ardalis.GuardClauses 4.6 at the top level and 4.5 in a transitive library, then exercise GuardClauseExtensions.NullOrEmpty and capture the runtime failure. Compare the package versions and public method signature involved; done means the mixed-version setup no longer throws MissingMethodException, with the reported 4.5 and 4.6 scenarios covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100