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

Do not allow a non-keyed service to be injected to a keyed parameter #105839

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix test issue on NetFx
  • Loading branch information
steveharter committed Aug 7, 2024
commit d87e6e47e72b0b24b9e072256fb6d1c9f8a3f876
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,9 @@ public void ResolveKeyedServiceWithKeyedParameter_MissingRegistrationButWithUnke
}));

Assert.Equal(1, ex.InnerExceptions.Count);
Assert.Contains("ServiceType: Microsoft.Extensions.DependencyInjection.Specification.KeyedDependencyInjectionSpecificationTests+OtherService", ex.Message);
Assert.Contains("Microsoft.Extensions.DependencyInjection.Specification.KeyedDependencyInjectionSpecificationTests+IService", ex.InnerExceptions[0].Message);
Assert.StartsWith("Some services are not able to be constructed", ex.Message);
Assert.Contains("ServiceType: Microsoft.Extensions.DependencyInjection.Specification.KeyedDependencyInjectionSpecificationTests+OtherService", ex.ToString());
Assert.Contains("Microsoft.Extensions.DependencyInjection.Specification.KeyedDependencyInjectionSpecificationTests+IService", ex.ToString());
}

private async Task<bool> ResolveUniqueServicesConcurrently()
Expand Down
Loading