You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingMicrosoft.Extensions.DependencyInjection;varservices=newServiceCollection();services.AddKeyedTransient<Service>(KeyedService.AnyKey);// This line throws// System.InvalidOperationException: 'The type of the key used for lookup doesn't match the type in the constructor parameter with the ServiceKey attribute.'usingvarprovider=services.BuildServiceProvider(newServiceProviderOptions{ValidateOnBuild=true});publicclassService{publicService([ServiceKey]ServiceserviceKey){}}