C# "CS1503: Argument N: cannot convert from A to B" in CI
CS1503 means you passed an argument the method does not accept - the Nth argument's type cannot convert to the parameter type. It often appears after a package upgrade changed a signature, or when an overload you expected does not exist.
What this error means
Build fails with CS1503 naming the argument position and the from/to types. Deterministic for the source + reference versions.
Handler.cs(31,38): error CS1503: Argument 2: cannot convert from 'int' to
'System.Threading.CancellationToken'Common causes
The argument type does not match the parameter
The value passed is a different type than the method expects, and no implicit conversion exists.
A signature changed across a package version
An upgrade reordered or retyped parameters, so existing call sites pass the wrong type.
How to fix it
Pass the correct argument type
- Check the method signature for the expected parameter type and order.
- Convert or supply the right value (e.g. a
CancellationTokeninstead of an int). - Rebuild.
await repo.SaveAsync(entity, cancellationToken);Align with the upgraded API
- Read release notes for the changed signature.
- Update call sites, or pin the previous package version if needed.
- Rebuild.
How to prevent it
- Build after package upgrades to catch signature changes early.
- Pin package versions with a lock file so CI matches local.
- Use named arguments for clarity on multi-parameter calls.