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 Resolver hierarchy + shadowed registration resolution #235

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

bradfol
Copy link
Collaborator

@bradfol bradfol commented Jan 29, 2025

There is a potential bug with resolution when using parent-child containers and shadowed registrations. This fix ensures that when performing resolution that a parent container can never have access to registrations in a child container. Previously, the container that received the resolve() call was captured and used for later factory invocations, and if that receiver was a child that also had a shadowed registration of the parent then the bug could emerge.

This implements the same change as Swinject/Swinject#567 but does not retain an option to use the old behavior. Instead, we are considering the old Swinject behavior to be a bug, and are directly fixing for Knit.

There is a potential bug with resolution when using parent-child containers and shadowed registrations. This fix ensures that when performing resolution that a parent container can never have access to registrations in a child container. Previously, the container that received the `resolve()` call was captured and used for later factory invocations, and if that receiver was a child that also had a shadowed registration of the parent then the bug could emerge.

This implements the same change as Swinject/Swinject#567 but does not retain an option to use the old behavior. Instead, we are considering the old Swinject behavior to be a bug, and are directly fixing for Knit.
@bradfol bradfol requested a review from skorulis-ap January 29, 2025 18:51
@bradfol bradfol merged commit e63c5ad into main Jan 29, 2025
1 check passed
@bradfol bradfol deleted the bradfol/fix-capture-bug branch January 29, 2025 23:46
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.

2 participants