-
-
Notifications
You must be signed in to change notification settings - Fork 94
Correctly extract Test FilePath and LineNumber in Reflection mode #3132
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
|
Claude finished @thomhurst's task —— View job Code Review Progress
|
|
Claude finished @thomhurst's task —— View job Code Review ProgressReviewing PR #3132: "Correctly extract Test FilePath and LineNumber in Reflection mode" Todo List:
Code Review SummaryThis PR contains two distinct fixes across multiple commits addressing different issues in reflection mode: 🔧 Core Fix: File Path and Line Number Extraction (commit f0f3ef3)✅ Primary Issue Resolved: // BEFORE: Always returned null
private static string? ExtractFilePath(MethodInfo method)
{
method.GetCustomAttribute<TestAttribute>();
// Reflection doesn't have access to file path from CallerFilePath
return null;
}
// AFTER: Correctly extracts from TestAttribute
private static string? ExtractFilePath(MethodInfo method)
{
return method.GetCustomAttribute<TestAttribute>()?.File;
}Same pattern applied to 🛠️ Additional Fix: Null Type Filtering (commit c39b5a3)✅ Secondary Issue Resolved: // BEFORE: Could include null types
return reflectionTypeLoadException.Types;
// AFTER: Filters out null types safely
return reflectionTypeLoadException.Types.Where(x => x != null).ToArray()!;📋 Code Quality Assessment✅ Excellent Changes:
✅ Follows TUnit Standards:
🔍 Technical Analysis✅ No Issues Found:
✅ Defensive Programming:
🧪 Test Coverage RecommendationsShould be tested (if not already covered):
📊 Overall Assessment✅ EXCELLENT IMPLEMENTATION This PR delivers exactly what's needed:
Recommendation: ✅ APPROVE Both fixes are well-implemented, necessary, and align perfectly with TUnit's design principles. The changes ensure reflection mode can extract file/line information when available, bringing it closer to feature parity with source generation mode. |

Fixes #3034