Skip to content

Analyzer - theory data row inside theory data#195

Merged
bradwilson merged 7 commits intoxunit:mainfrom
snailtempo:feature/analyzer-theoryDataRow-inside-theoryData
Jul 8, 2025
Merged

Analyzer - theory data row inside theory data#195
bradwilson merged 7 commits intoxunit:mainfrom
snailtempo:feature/analyzer-theoryDataRow-inside-theoryData

Conversation

@snailtempo
Copy link
Contributor

@snailtempo snailtempo commented Jul 6, 2025

Addresses issue #3113 - Add analyzer to flag using ITheoryDataRow inside of TheoryData

Includes:

  • Analyzer to detect TheoryData<ITheoryDataRow> and stronger types
  • Added code fix to suggest IEnumerable<ITheoryDataRow>
  • Analyzer/Codefix tests

Note: This is my first time contributing to this project and also my first time writing a Roslyn analyzer, so I wasn’t completely sure about some of the design decisions. Feedback is very welcome!

For instance, I was not sure if a code fix should be provided in such a scenario:

TheoryData<ITheoryDataRow> GetData() { return null; } // Currently: Codefix enabled, but could lead to invalid code (depending on method implementation)

@snailtempo
Copy link
Contributor Author

@dotnet-policy-service agree

@bradwilson
Copy link
Member

Thanks! I'm consolidating the tests for better performance (the compilation process is extremely expensive, so I've been doing this to all the existing tests as time allows).

@bradwilson bradwilson merged commit 357178d into xunit:main Jul 8, 2025
1 check passed
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.

2 participants