-
Notifications
You must be signed in to change notification settings - Fork 235
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
Fix child resolve for types with generic interfaces #137
Fix child resolve for types with generic interfaces #137
Conversation
@@ -13,6 +13,12 @@ | |||
// FITNESS FOR A PARTICULAR PURPOSE. | |||
//=============================================================================== | |||
|
|||
#region Preprocessor Directives | |||
|
|||
#define RESOLVE_OPEN_GENERICS // Platform supports resolving open generics |
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.
Can this get moved to the csproj
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.
Done in #141
@@ -3716,23 +3716,26 @@ private ObjectFactoryBase GetParentObjectFactory(TypeRegistration registration) | |||
|
|||
ObjectFactoryBase factory; | |||
|
|||
if (_Parent._RegisteredTypes.TryGetValue(registration, out factory)) |
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.
Any idea why this was moved out? It would be nice to have additional test coverage for any changes.
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.
@joaomsa ^^
Thanks for the PR, I see there is a test for this but not sure why |
@joaomsa can you please check out my feedback and questions. |
@joaomsa can you please check out my feedback and questions. |
Sorry about the delay, but we no longer use TinyIoC. |
Similar to #127 , when attempting to resolve an open generic type from a child container it would fail to lookup for the generic definition in the parent container.
There was already a test covering just this case in
https://github.com/grumpydev/TinyIoC/blob/master/tests/TinyIoC.Tests/TinyIoCTests.cs#L3367
but because it was within a RESOLVE_OPEN_GENERICS region with that directive never being set it was failing.
Not sure how your testing matrix is setup but now that I've added the directive to the file header it runs those tests properly.
This also resolves #128