You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a local fuzz harness for analyzers and code fixes - #4350
Adds a local, deterministic harness that mutates C# and runs every StyleCop analyzer and code fix in a worker process. It is intentionally not in StyleCopAnalyzers.slnx and has no workflow job. The same seed, corpus, and iteration count replay the same candidates, so a required mutate check would be unstable. A new seed or more iterations can surface different bugs, but only by sampling.
Also adds .agents/skills/fuzz-analyzers/SKILL.md and a row in AGENTS.md. A later agent can use that skill to run another campaign and turn a confirmed crash, or a code fix that breaks valid code, into a test-first fix. Campaign output stays outside the repo.
No analyzer or code-fix behavior changes. The tool's self-test passes locally. CI will not build this project.
Left out, on purpose:
coverage-guided fuzzing
automatic issue filing
a CI or scheduled mutate/repro job
repro of a signature directory now restores the saved filename and settings from input.json, replays edits to input.cs, and does not analyze fixed.cs. Ordinary seeds and their settings sidecars are unchanged. Covered by the harness self-test.
Keep the campaign tool out of the solution and CI. Document how to rerun it and how to turn a confirmed finding into a test-first fix.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7b84c03c-f9e3-4447-96f6-caff454f3096
Adds a local deterministic fuzz harness for StyleCop analyzers and code fixes, supporting #4338 without changing shipping behavior or adding CI integration.
Changes:
Adds corpus extraction, mutation, worker isolation, and saved findings.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.65%. Comparing base (4371321) to head (e945fd6). ⚠️ Report is 3 commits behind head on master.
A signature directory was loaded as ordinary seeds, so input.json was treated as stylecop.json and fixed.cs was analyzed. Replay the minimized input.cs with the saved envelope instead.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7b84c03c-f9e3-4447-96f6-caff454f3096
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Broken worker pipes can abort campaigns, and exception-signature collisions can discard independent reproducers.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Include stack traces to distinguish exception throw sites
tools/StyleCop.Analyzers.Fuzz/Program.cs:147
Using only the first exception line gives different NullReferenceException throw sites in the same analyzer or fix action identical signatures. Analyzer exceptions also leave Rule and Action empty. The shortest-input replacement then retains only one reproducer, hiding an independent failure. Include stack-trace information in exception signatures, and add a regression case with identical exception messages from different throw sites.
Handle broken-pipe I/O failures without aborting the campaign
tools/StyleCop.Analyzers.Fuzz/Program.cs:192
If the worker exits before or while reading the request, this write throws an IOException (broken pipe), rather than reaching the null-output crash handling below. Only TimeoutException is caught, so the entire campaign aborts without saving this input or restarting the worker. Catch pipe I/O failures and return a Crash finding after disposing the worker so subsequent inputs can still run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4338
Adds a local, deterministic harness that mutates C# and runs every StyleCop analyzer and code fix in a worker process. It is intentionally not in
StyleCopAnalyzers.slnxand has no workflow job. The same seed, corpus, and iteration count replay the same candidates, so a requiredmutatecheck would be unstable. A new seed or more iterations can surface different bugs, but only by sampling.Also adds
.agents/skills/fuzz-analyzers/SKILL.mdand a row inAGENTS.md. A later agent can use that skill to run another campaign and turn a confirmed crash, or a code fix that breaks valid code, into a test-first fix. Campaign output stays outside the repo.No analyzer or code-fix behavior changes. The tool's
self-testpasses locally. CI will not build this project.Left out, on purpose:
mutate/reprojobreproof a signature directory now restores the saved filename and settings frominput.json, replays edits toinput.cs, and does not analyzefixed.cs. Ordinary seeds and their settings sidecars are unchanged. Covered by the harnessself-test.