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.
dotnet
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.
.cs
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.
Related guides
C# "CS0029: Cannot implicitly convert type A to B" in CIFix C# "CS0029: Cannot implicitly convert type A to B" in CI - assigning a value to a variable of an incompat…
C# "CS0019: Operator cannot be applied to operands" in CIFix C# "CS0019: Operator X cannot be applied to operands of type A and B" in CI - combining or comparing inco…
C# "CS1061: X does not contain a definition for Y" in CIFix C# "CS1061: X does not contain a definition for Y" in CI - a renamed or removed member, or a missing usin…