Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Generics constrained with generic parameters do not resolve #816

Closed
zacateras opened this issue Dec 21, 2016 · 0 comments
Closed

Generics constrained with generic parameters do not resolve #816

zacateras opened this issue Dec 21, 2016 · 0 comments

Comments

@zacateras
Copy link
Contributor

zacateras commented Dec 21, 2016

The issue can be described by the following failing XUnit test:

public class ConstrainedWithGenericParameter<T1, T2>
    where T1 : T2
{
}

[Fact]
public void CanResolveComponentWhenGenericParameterIsConstrainedWithOtherGenericParameter()
{
    var builder = new ContainerBuilder();

    builder.RegisterGeneric(typeof(ConstrainedWithGenericParameter<,>));

    var container = builder.Build();

    Assert.True(container.IsRegistered<ConstrainedWithGenericParameter<int, object>>());
}

It seems that generic parameter constraint compatibility check always returns true for generic constraints stub types like {T1}, {T2}.

I submitted solution to the issue in #819.

@zacateras zacateras changed the title Generics constrained with generic parameters does not resolve Generics constrained with generic parameters do not resolve Dec 21, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant