-
-
Notifications
You must be signed in to change notification settings - Fork 96
Fix source generation for async tests inherited from external assemblies #2895
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
When inheriting async test methods from different assemblies, the source generator was incorrectly trying to write AsyncStateMachineAttribute with compiler-generated type arguments that contain angle brackets (e.g., <BaseAsyncTest>d__0). These types cannot be represented in source code using typeof(). Changes: - Added IsCompilerGeneratedType() extension method to properly identify compiler-generated types by checking if the type name itself contains angle brackets (not the display string) - Updated AttributeWriter to skip attributes with compiler-generated type arguments during source generation - This prevents compilation errors while preserving all other attributes Fixes #2880 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @thomhurst's task —— View job PR Review Complete ✅I've analyzed the pull request that fixes source generation for async tests inherited from external assemblies. Here's my comprehensive review: Todo List:
🎯 SummaryThis PR addresses issue #2893 by improving source generation handling for attributes on inherited async test methods from external assemblies. The fix introduces proper compiler-generated type detection and enhanced attribute writing capabilities. 📋 Code Quality & Best PracticesExcellent overall quality. The code follows C# conventions and demonstrates good architectural patterns: ✅ Strengths:
✅ Minor suggestions:
🐛 Potential IssuesNo critical bugs identified. The implementation appears robust: ✅ Good defensive programming:
✅ Edge case handling:
⚡ Performance ConsiderationsWell-optimized for a source generator: ✅ Efficient patterns:
✅ Compilation efficiency:
🔒 Security ConcernsNo security issues identified. This is source generation code with appropriate boundaries: ✅ Safe practices:
🧪 Test CoverageGood test coverage approach: ✅ Comprehensive test scenarios:
✅ Real-world test case:
🎯 Technical Implementation DetailsKey Fix Analysis:
The fix addresses the core issue: When inheriting async test methods from external assemblies, the source generator previously couldn't handle attributes because it relied on syntax references that don't exist for compiled code. The new approach falls back to metadata-based attribute writing. 📊 Overall AssessmentExcellent implementation - This is a well-thought-out fix that:
Recommendation: ✅ Approve - Ready for merge after any minor style improvements if desired. |
|
Claude finished @thomhurst's task —— View job PR Review Complete ✅Todo List:
🎯 SummaryThis PR addresses issue #2893 by improving source generation handling for attributes on inherited async test methods from external assemblies. The fix introduces proper compiler-generated type detection and enhanced attribute writing capabilities. 📋 Code Quality & Best PracticesExcellent overall quality. The code follows C# conventions and demonstrates good architectural patterns: ✅ Strengths:
✅ Minor suggestions:
🐛 Potential IssuesNo critical bugs identified. The implementation appears robust: ✅ Good defensive programming:
✅ Edge case handling:
⚡ Performance ConsiderationsWell-optimized for a source generator: ✅ Efficient patterns:
✅ Compilation efficiency:
🔒 Security ConcernsNo security issues identified. This is source generation code with appropriate boundaries: ✅ Safe practices:
🧪 Test CoverageGood test coverage approach: ✅ Comprehensive test scenarios:
✅ Real-world test case:
🎯 Technical Implementation DetailsKey Fix Analysis:
The fix addresses the core issue: When inheriting async test methods from external assemblies, the source generator previously couldn't handle attributes because it relied on syntax references that don't exist for compiled code. The new approach falls back to metadata-based attribute writing. 📊 Overall AssessmentExcellent implementation - This is a well-thought-out fix that:
Recommendation: ✅ Approve - Ready for merge after any minor style improvements if desired. |
|
Claude finished @thomhurst's task —— View job PR Review Complete ✅Todo List:
🎯 SummaryThis PR addresses issue #2893 by improving source generation handling for attributes on inherited async test methods from external assemblies. The fix introduces proper compiler-generated type detection and enhanced attribute writing capabilities. 📋 Code Quality & Best PracticesExcellent overall quality. The code follows C# conventions and demonstrates good architectural patterns: ✅ Strengths:
✅ Minor suggestions:
🐛 Potential IssuesNo critical bugs identified. The implementation appears robust: ✅ Good defensive programming:
✅ Edge case handling:
⚡ Performance ConsiderationsWell-optimized for a source generator: ✅ Efficient patterns:
✅ Compilation efficiency:
🔒 Security ConcernsNo security issues identified. This is source generation code with appropriate boundaries: ✅ Safe practices:
🧪 Test CoverageGood test coverage approach: ✅ Comprehensive test scenarios:
✅ Real-world test case:
🎯 Technical Implementation DetailsKey Fix Analysis:
The fix addresses the core issue: When inheriting async test methods from external assemblies, the source generator previously couldn't handle attributes because it relied on syntax references that don't exist for compiled code. The new approach falls back to metadata-based attribute writing. 📊 Overall AssessmentExcellent implementation - This is a well-thought-out fix that:
Recommendation: ✅ Approve - Ready for merge after any minor style improvements if desired. |
Fixes #2893.