Skip to content

Commit

Permalink
Merge pull request #346 from drieseng/unbound
Browse files Browse the repository at this point in the history
Do not attempt to handle unbound generic type definition as collection.
  • Loading branch information
drieseng authored Mar 5, 2019
2 parents 5763318 + f4f9609 commit b23a959
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Ninject.Test/Integration/ReadOnlyKernelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,7 @@ public void TryGet_ServiceAndConstraintAndParameters_ShouldPreferBindingForList(
bindings.Should().HaveCount(2);
}


[Fact(Skip = "https://github.com/ninject/Ninject/issues/340")]
[Fact]
public void TryGet_ServiceAndConstraintAndParameters_ReturnsNullWhenTypeIsUnboundGenericTypeDefinition()
{
var service = typeof(List<>);
Expand Down Expand Up @@ -799,7 +798,7 @@ public void TryGet_ServiceAndConstraintAndParameters()
bindings.Should().BeEmpty();
}

[Fact(Skip = "https://github.com/ninject/Ninject/issues/340")]
[Fact]
public void TryGet_ServiceAndConstraintAndParameters_ReturnsNullWhenTypeIsUnboundGenericTypeDefinition()
{
var service = typeof(List<>);
Expand Down
2 changes: 1 addition & 1 deletion src/Ninject/ReadOnlyKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ void UpdateRequest(Type service)
return this.ResolveAll(request, false).CastSlow(service).ToArraySlow(service);
}

if (request.Service.IsGenericType)
if (request.Service.IsGenericType && !request.Service.IsGenericTypeDefinition)
{
var gtd = request.Service.GetGenericTypeDefinition();

Expand Down

0 comments on commit b23a959

Please sign in to comment.