prql
prql copied to clipboard
fix(dotnet): correct ArgumentException constructor usage
Summary
- The five
IsNullOrEmptyguards inPrqlCompiler.csthrewnew ArgumentException(nameof(prqlQuery)), which passes the parameter name into the message slot of the single-stringArgumentException(string message)constructor. The thrown exception ended up withMessage == "prqlQuery"(the literal param name) andParamName == null— the opposite of what the calls looked like they intended. - Replace each guard with
ArgumentException.ThrowIfNullOrEmpty(prqlQuery)to match the adjacentArgumentNullException.ThrowIfNull(options)style and setParamNamecorrectly. - Add regression tests on
ParamNamefor each entry point; they would have caught the bug since the previous code leftParamNamenull.
Found during the nightly file survey (the related ArgumentNullException-vs-ArgumentException mismatch was item #5 in #5847, but this specific message-vs-paramName confusion wasn't covered there).
Test plan
- [ ]
test-dotnetjob builds and runs all 10 tests - [ ] New
ThrowsArgumentException_When*tests pass - [ ] Existing tests continue to pass
🤖 Generated with Claude Code
Follow-up on my review: I can't actually file the path-filter PR — pushing .github/workflows/tests.yaml requires workflow scope, which the bot token doesn't have. A maintainer would need to apply the one-character change directly:
dotnet:
- - prqlc/bindings/prql-dotnet/**
+ - prqlc/bindings/dotnet/**
- prqlc/bindings/prqlc-c/**
- .github/workflows/test-dotnet.yaml
@prql-bot try again
Push worked this time — the token now has workflow scope. Filed as #5965.