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
Fixed inspections and quick fixes registration in Castle Windsor #3845
Conversation
I'm not familiar with CW, so this fix might not be the best approach. I don't know why |
Codecov Report
@@ Coverage Diff @@
## next #3845 +/- ##
=========================================
+ Coverage 55.99% 56% +0.01%
=========================================
Files 827 827
Lines 28613 28611 -2
=========================================
+ Hits 16020 16021 +1
+ Misses 12593 12590 -3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix is basically right, but the Base()
must be replaced with an explicit selection in all cases.
The basic problem here is that removing the BasedOn
robs CW of the information what the base should be. So, it defaults to object
. To use the services Base()
and FromInterface()
it is necessary to select via BasedOn<>
.
Maybe we should switch back to that and use the If
or Unless
to add the experimental feature condition. Unfortunately, I do not really know whether these work as expected as they are missing from the CW documentation.
@@ -244,8 +244,7 @@ private void RegisterQuickFixes(IWindsorContainer container, Assembly[] assembli | |||
container.Register(Classes.FromAssembly(assembly) | |||
.IncludeNonPublicTypes() | |||
.Where(type => type.IsBasedOn(typeof(IQuickFix)) && type.NotDisabledExperimental(_initialSettings)) | |||
.WithService.Base() | |||
.WithService.Self() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Self()
should work and is important at the places where specific quickfixes get injected.
@@ -269,7 +268,6 @@ private void RegisterParseTreeInspections(IWindsorContainer container, Assembly[ | |||
container.Register(Classes.FromAssembly(assembly) | |||
.IncludeNonPublicTypes() | |||
.Where(type => type.IsBasedOn(typeof(IParseTreeInspection)) && type.NotDisabledExperimental(_initialSettings)) | |||
.WithService.Base() | |||
.WithService.Select(new[] { typeof(IInspection) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be extended by typeof(IParseTreeInspection)
to account for the removed Base()
.
I just looked further in the CW documentation. There was no link in the part about registration by convention but in the part about registering component-by-component. Conditional component registration After reading this, I think we should go back to |
Apparently some PR broke the IoC registration for inspections and quick fixes. Only
ParseTreeInspections
were registered correctly. Other inspections and all quick fixes were not registered at all or registered having service type ofObject
. This PR's purpose is to restore the functionality.