add-compiler-diagnostic-fix
Use when adding a Roslynator code fix for C# compiler error CS#### or RCF####, editing Diagnostics.xml or CodeFixes.xml, or when compiler-diagnostic-fixes-testing.md shows XunitCompilerDiagnosticFixVerifier or bare DiagnosticId like "CS0106" — in-repo uses AbstractCSharpCompilerDiagnosticFixVerifier and CompilerDiagnosticIdentifiers. Contributor how-to exists but testing page targets NuGet consumers.
Оригинален текст · няма потвърден превод на българскиПърво прочетете инструкцията.
Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.
GitHub хранилище- Звезди на репото
- 3481
- Лиценз
- NOASSERTION
- Последна проверка на записа
- 22.09.2026 г.
Добавете в своя инструмент.
Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.
npx skills add dotnet/roslynatorСтраницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.
Откъс от SKILL.md
Началото на файла на автора, без превод.
Add Compiler Diagnostic Fix
Overview
Compiler fixes use Diagnostics.xml + CodeFixes.xml → codegen → CompilerDiagnosticCodeFixProvider → test. Contributor how-to: how-to-add-compiler-diagnostic-fix. Do not follow compiler-diagnostic-fixes-testing alone — it targets NuGet consumers.
When to Use
- New fix for
CS####compiler diagnostic - New
RCF####entry linking one or moreCSids - Extending fix coverage for an existing compiler error
Not for: Roslynator analyzers (add-analyzer), refactorings (add-refactoring).
Gate: approved GitHub issue (CONTRIBUTING.md).
Read references/implementation.md before writing tests.
Confirm metadata parameters (hard gate)
STOP. Do NOT edit Diagnostics.xml / CodeFixes.xml, run codegen, or implement until the user has confirmed every required parameter below. Do not invent titles or identifiers when the user (or issue) did not state them.
Use AskQuestion when available; otherwise ask conversationally. Batch related choices.
| Parameter | Required? | Notes |
|---|---|---|
Compiler CS#### id(s) | yes | One RCF may fix multiple CS ids |
New Diagnostics.xml entry? | if CS not already cataloged | Confirm Title / Message / HelpUrl (usually from Microsoft docs) |
RCF Id | propose | Compute next free RCF#### from CodeFixes.xml, or extend an existing RCF when appropriate; do not ask unless ambiguous |
Identifier | yes | PascalCase for the code fix |
Title | yes | Code-fix menu / docs title |
| Code action title | yes | String passed to CodeAction.Create (may match or differ from XML Title) |
When proposing RCF Id, state the chosen value in your plan/summary (e.g. “using next free RCF0121”). Skip asking other parameters only when the approved issue or the user's message already states the value explicitly.
Quick Reference
| Step | Location |
|---|---|
| Diagnostic catalog | src/Diagnostics.xml |
| Fix metadata | src/CodeFixes.xml |
| Codegen | cd tools && pwsh ./generate_code.ps1 |
| Provider | src/CodeFixes/CSharp/CodeFixes/ |
| Tests | src/Tests/CodeFixes.Tests/CS####IdentifierTests.cs |
| Changelog | CHANGELOG.md |