You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'd like to ask for your help with the following issue.
Given a top-level service class TopLevelService having 2 dependencies
Required TopLevelServiceOptions
Optional IDependencyServiceIntercepted, implemented using constructor overloading
Given that IDependencyServiceIntercepted is intercepted using an interceptor
This is set up using a IContributeComponentModelConstruction
Given that everything is properly registered
When I resolve the TopLevelService...
Then it should use the constructor with 2 parameters, passing the resolved intercepted dependency service
But, instead, the library chooses the constructor having only the single TopLevelServiceOptions parameter.
As far as I could debug, the issue is that during resolution, the handler for IDependencyServiceIntercepted is still in WaitingDependencies state. If I'm not using the interceptor, the handler is in the proper Active state, and the resolution works as expected.
I've attached a simple console app reproducint the issue. It throws a NullReferenceException when it should not.
A quick look at the code and I'd have thought it would work. The InterceptorInspector which converts InterceptorAttribute attributes uses IContributeComponentModelConstruction.
Does it work if you change the InterceptorReference to use the component type? i.e.:
Thank you for your quick reply. First of all, sorry for the quality of the sample project, I've just now noticed that it doesn't even build, some refactoring has failed and also it was cut out from a solution where central package management was used.
Using the concrete type in the interceptor reference solves the issue, thank you.
Hi,
We'd like to ask for your help with the following issue.
TopLevelService
having 2 dependenciesTopLevelServiceOptions
IDependencyServiceIntercepted
, implemented using constructor overloadingIDependencyServiceIntercepted
is intercepted using an interceptorIContributeComponentModelConstruction
TopLevelService
...But, instead, the library chooses the constructor having only the single
TopLevelServiceOptions
parameter.As far as I could debug, the issue is that during resolution, the handler for
IDependencyServiceIntercepted
is still inWaitingDependencies
state. If I'm not using the interceptor, the handler is in the properActive
state, and the resolution works as expected.I've attached a simple console app reproducint the issue. It throws a
NullReferenceException
when it should not.IssueWithConstructorOverloadAndInterception.zip
Thank you very much in advance for your support.
The text was updated successfully, but these errors were encountered: