Improve test class discovery#327
Conversation
- Test-class filtering logic moverd to shared code so class scanning now excludes Attribute-derived types before calling type-level custom-attribute reflection.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: nanoframework/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughA new helper method ChangesTest Type Candidate Classification
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@source/TestFrameworkShared/Helper.cs`:
- Around line 25-38: IsAttributeType currently walks current.BaseType and reads
current.FullName without handling TypeLoadException; in environments where
resolving base types can fail (desktop-reflection), this can yield false
negatives—wrap the BaseType traversal in a try/catch that catches
TypeLoadException (and any specific reflection exceptions you see) when
accessing current.BaseType or current.FullName and on catch conservatively treat
the inspected type as an attribute type (i.e., return true) so failing to
resolve a base type won’t incorrectly classify an attribute-derived type as a
test class; update the IsAttributeType method accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: nanoframework/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 354eb471-92fc-43dd-bf4b-0a13e450d561
📒 Files selected for processing (3)
source/TestAdapter/Discover.cssource/TestFrameworkShared/Helper.cssource/UnitTestLauncher/Program.cs

Description
Motivation and Context
How Has This Been Tested?
Screenshots
Types of changes
Checklist: