Skip to content

Add NES013 analyzer diagnostic for throw statements#445

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-nes-analyzer-diagnostic-throw-statements
Draft

Add NES013 analyzer diagnostic for throw statements#445
Copilot wants to merge 2 commits intomainfrom
copilot/add-nes-analyzer-diagnostic-throw-statements

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

The transpiler rejects Throw/Rethrow IL opcodes at transpile time, but there was no Roslyn analyzer to surface this in the IDE. Users only discovered the error during MSBuild transpilation.

Adds NES013 diagnostic for ThrowStatement and ThrowExpression syntax kinds, matching the existing pattern (e.g. NES011 for try/catch).

  • Analyzer: New NES013Rule descriptor, registered for both SyntaxKind.ThrowStatement and SyntaxKind.ThrowExpression
  • Release tracking: Added to AnalyzerReleases.Unshipped.md
  • Tests: Three cases — throw statement, throw expression, and negative (no throw)
// NES013 error on both forms:
throw null;                                        // ThrowStatement
byte x = condition ? (byte)1 : throw null;         // ThrowExpression

Copilot AI changed the title [WIP] Add NES analyzer diagnostic for throw statements Add NES013 analyzer diagnostic for throw statements Apr 4, 2026
Copilot AI requested a review from jonathanpeppers April 4, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add NES analyzer diagnostic for throw statements

2 participants