Learn / .NET / CS1003 syntax error
C# "CS1003: Syntax error, X expected" in CI
By Daniel Zoghalchali · Latchkey
CS1003 reports that the parser was looking for a particular token - a comma, a closing brace, an angle bracket - and the next token did not match. It is a structural typo: a missing separator, an extra token, or a mismatched bracket.
What this error means The build fails with CS1003 naming the token it expected. It is fully deterministic.
dotnet
Dto.cs(18,40): error CS1003: Syntax error, ',' expectedCommon causes A missing or extra separator A comma between arguments or generic type parameters is missing, or an extra one was left behind after a refactor.
A mismatched bracket or generic angle An unbalanced <>, (), or {} makes the parser expect a different token than what appears.
How to fix it Fix the token at the reported position
Open the line and column from the error and add or remove the expected token.
Verify generic type argument lists and method signatures are balanced.
Rebuild.
This will hit your next .NET build too
The fix you just applied is mechanical, and nothing about it needed a human. On Latchkey managed runners this failure is detected, repaired, and the job retried automatically, so the time you just spent is not spent again. Start free - 30-day trial, no credit card required - or see how self-healing works .
How to prevent it
Rely on editor bracket matching and format-on-save.
Keep PRs small so syntax slips are caught in review.
Frequently asked questions What causes ""CS1003: Syntax error""? A comma between arguments or generic type parameters is missing, or an extra one was left behind after a refactor.
How do I fix "CS1003: Syntax error"? Fix the token at the reported position
Related guides References
Start free on self-healing runners
NuGet restores are slow and flake on transient feed errors. Latchkey runs your GitHub Actions on managed runners that detect, fix, and retry transient failures automatically. Switching is one line: change runs-on: and the rest of the workflow is untouched. Up to 70% cheaper than GitHub-hosted, with free minutes on every plan.
30-day free trial · No credit card required · Set up in minutes
Previous CS1002 semicolon expectedNext CS1061 missing extension using