Skip to content
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

Conversation

joaomsa
Copy link
Contributor

@joaomsa joaomsa commented May 18, 2020

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

@@ -13,6 +13,12 @@
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================

#region Preprocessor Directives

#define RESOLVE_OPEN_GENERICS // Platform supports resolving open generics
Copy link
Collaborator

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

Copy link
Contributor

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))
Copy link
Collaborator

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niemyjski
Copy link
Collaborator

Thanks for the PR, I see there is a test for this but not sure why if (_Parent._RegisteredTypes.TryGetValue(registration, out factory)) was moved out if tests were passing before?

@niemyjski
Copy link
Collaborator

@joaomsa can you please check out my feedback and questions.

@niemyjski
Copy link
Collaborator

@joaomsa can you please check out my feedback and questions.

@joaomsa
Copy link
Contributor Author

joaomsa commented Nov 24, 2020

Sorry about the delay, but we no longer use TinyIoC.
Feel free to close this PR.

@niemyjski niemyjski merged commit 4ee258c into grumpydev:master Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants