-
-
Notifications
You must be signed in to change notification settings - Fork 86
Fix abstract class constructor processing in hook metadata generation #2888
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>
[Before(Test)]
breakage
Claude finished @Copilot's task —— View job Code Review Complete ✅Todo List:
📋 Review SummaryThis PR provides an excellent fix for issue #2887. The solution is well-designed, thoroughly tested, and maintains backward compatibility. ✅ StrengthsCode Quality
Problem Resolution
Test Coverage
💡 Minor ObservationsCode OrganizationThe fix appears in two places due to method duplication:
This is actually good practice as it maintains consistency across both code paths. Performance Considerations
🔒 Security Assessment
🎯 Test Strategy EvaluationThe testing approach is solid:
📊 Overall AssessmentThis is a high-quality fix that:
Recommendation: ✅ Approve The fix is ready to merge. It addresses the root cause, includes proper testing, and maintains code quality standards. |
The hook metadata generator was failing when processing abstract base classes that have parameterized constructors and hook methods. This resulted in a
NullReferenceException
during test discovery.Problem
The issue occurred when:
protected
)[Before(Test)]
The
WriteClassMetadataGetOrAdd
method inMetadataGenerationHelper.cs
was callingtypeSymbol.InstanceConstructors.FirstOrDefault()
which returns any instance constructor, including protected ones. For abstract classes with parameterized constructors, this would select a protected constructor and later cause issues during metadata generation.Example that previously failed
This would throw:
Solution
Modified the constructor selection logic in
MetadataGenerationHelper.cs
to:The fix maintains backward compatibility while properly handling abstract inheritance patterns commonly used with dependency injection.
Testing
BaseClass<T>
) continue to workFixes #2887.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms
curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.