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

Adding support for constrained open generics to DI #39540

Merged
merged 4 commits into from Aug 15, 2020

Conversation

jbogard
Copy link
Contributor

@jbogard jbogard commented Jul 17, 2020

Backed-out pull request: #34393
Previous pull request: dotnet/extensions#536
Original discussion: aspnet/DependencyInjection#471
Original pull request: aspnet/DependencyInjection#635
First naive pull request: aspnet/DependencyInjection#472

3rd 4th time's the charm?

All of the DI packages now support all of the specification tests added.

@msftbot
Copy link
Contributor

msftbot bot commented Jul 17, 2020

Tagging subscribers to this area: @eerhardt, @maryamariyan
Notify danmosemsft if you want to be subscribed.

@maryamariyan
Copy link
Member

maryamariyan commented Jul 20, 2020

@jbogard
Copy link
Contributor Author

jbogard commented Jul 20, 2020

@maryamariyan fixed!

@jbogard
Copy link
Contributor Author

jbogard commented Jul 22, 2020

@maryamariyan Anything else needed from my end?

@maryamariyan
Copy link
Member

maryamariyan commented Jul 30, 2020

@maryamariyan Anything else needed from my end?

@jbogard the CI checks are green.

Let's wait on @davidfowl 's approval on this.

@dquist
Copy link

dquist commented Aug 13, 2020

bump

@davidfowl
Copy link
Member

davidfowl commented Aug 14, 2020

Reviewing this now

… the generic type fails other than constraint failure
{
closedType = descriptor.ImplementationType.MakeGenericType(serviceType.GenericTypeArguments);
}
catch (ArgumentException)
Copy link
Member

@davidfowl davidfowl Aug 14, 2020

Choose a reason for hiding this comment

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

This exception happens once per service type right? Will get try to create the service with the wrong generic arguments more than once per service type?

Copy link
Contributor Author

@jbogard jbogard Aug 14, 2020

Choose a reason for hiding this comment

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

Yeah, exactly once per closed service type. Once it's correctly resolved the CallSite (well, IEnumerableCallSite), that result is cached like any other created CallSite.

Copy link
Member

@davidfowl davidfowl left a comment

LGTM, lets improve this in the future by solving #28033

@msftbot
Copy link
Contributor

msftbot bot commented Aug 15, 2020

Hello @maryamariyan!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@msftbot msftbot bot merged commit 2564f1a into dotnet:master Aug 15, 2020
92 checks passed
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@jbogard jbogard deleted the ConstrainedOpenGenerics branch Aug 24, 2020
@msftbot msftbot bot locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants