-
-
Notifications
You must be signed in to change notification settings - Fork 86
Fix: Allow compiler-generated types with test methods in reflection mode #2909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Claude finished @Copilot's task —— View job Code Review Complete ✅SummaryThis PR successfully addresses issue #2906 by modifying the reflection mode test discovery to allow compiler-generated types that contain test methods. The implementation is well-designed and addresses the specific Reqnroll use case while maintaining safety. Code Quality Assessment✅ Strengths
|
Claude finished @Copilot's task —— View job PR Code Review Complete ✅SummaryThis PR successfully addresses issue #2906 by modifying the reflection mode test discovery to allow compiler-generated types that contain test methods. The implementation is well-designed and addresses the specific Reqnroll use case while maintaining safety. Code Quality Assessment✅ Strengths
|
@claude [Claude Auto-Fix] Detected failed modularpipeline build (check run 48125968220). Please analyze the build failure at https://github.com/thomhurst/TUnit/actions/runs/16976294087/job/48125968220 and commit a fix for it. Instructions:
Focus on fixing only the build errors - do not make unrelated changes. |
@claude [Claude Auto-Fix] Detected failed modularpipeline build (check run 48125968220). Please analyze the build failure at https://github.com/thomhurst/TUnit/actions/runs/16976294087/job/48125968220 and commit a fix for it. Instructions:
Focus on fixing only the build errors - do not make unrelated changes. |
Claude finished @thomhurst's task —— View job Task: Fix Failed Build ✅Fixed GitVersion build failure for PR #2909. Todo List:
Root Cause AnalysisThe build failure was caused by a GitVersion tool error in the
This was a GitVersion bug when processing the merge commit Solution AppliedAdded the problematic merge commit hash to the ignore:
sha:
# ... existing ignored commits ...
- 02e60f4e1d7edc5e4e4ab51a5ac8732f3c94c8b5 # Fix GitVersion build failure This allows GitVersion to skip the problematic commit while still maintaining proper version calculation for the rest of the git history. Changes Made
The fix is now deployed to the PR branch. This should resolve the build failure without affecting the PR's core functionality (compiler-generated test discovery improvements). |
The GitVersion tool was failing with a NotImplementedException when processing the merge commit 02e60f4. This commit contains a complex merge structure that triggers an unimplemented code path in GitVersion's MainlineVersionStrategy. Adding the commit hash to the ignore list allows the build to proceed while maintaining proper version calculation for the rest of the git history. Co-authored-by: Tom Longhurst <thomhurst@users.noreply.github.com>
The reflection mode test discovery was incorrectly filtering out all types marked with
CompilerGeneratedAttribute
, which prevented execution of legitimate generated unit tests from tools like Reqnroll.Problem
The
IsCompilerGenerated
method inReflectionTestDataCollector.cs
used a blanket filter that excluded any type withCompilerGeneratedAttribute
:This broke Reqnroll-generated tests when upgrading from version 0.25.21 to 0.55.23, as Reqnroll marks its generated test classes with
CompilerGeneratedAttribute
to indicate they are code-generated from BDD feature files.Solution
Modified the filtering logic to be more sophisticated - compiler-generated types that contain test methods are now allowed through:
Testing
Added test cases in both VB.NET and C# projects to validate the fix:
VB.NET example:
C# example:
Verification
This fix preserves the original intent of filtering unwanted compiler artifacts while allowing legitimate generated test code to execute.
Fixes #2906.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.