prql icon indicating copy to clipboard operation
prql copied to clipboard

fix(dotnet): correct ArgumentException constructor usage

Open prql-bot opened this issue 6 months ago • 3 comments

Summary

  • The five IsNullOrEmpty guards in PrqlCompiler.cs threw new ArgumentException(nameof(prqlQuery)), which passes the parameter name into the message slot of the single-string ArgumentException(string message) constructor. The thrown exception ended up with Message == "prqlQuery" (the literal param name) and ParamName == null — the opposite of what the calls looked like they intended.
  • Replace each guard with ArgumentException.ThrowIfNullOrEmpty(prqlQuery) to match the adjacent ArgumentNullException.ThrowIfNull(options) style and set ParamName correctly.
  • Add regression tests on ParamName for each entry point; they would have caught the bug since the previous code left ParamName null.

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-dotnet job builds and runs all 10 tests
  • [ ] New ThrowsArgumentException_When* tests pass
  • [ ] Existing tests continue to pass

🤖 Generated with Claude Code

prql-bot avatar May 26 '26 07:05 prql-bot

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 avatar May 26 '26 07:05 prql-bot

@prql-bot try again

max-sixty avatar May 28 '26 17:05 max-sixty

Push worked this time — the token now has workflow scope. Filed as #5965.

prql-bot avatar May 28 '26 17:05 prql-bot