CallSiteRuntimeResolver. VisitFactory method implements adding IsInstanceOfType check#79232
CallSiteRuntimeResolver. VisitFactory method implements adding IsInstanceOfType check#79232AlexKuai wants to merge 1 commit intodotnet:mainfrom AlexKuai:main
Conversation
|
Tagging subscribers to this area: @dotnet/area-extensions-dependencyinjection Issue Detailsvar provider = new ServiceCollection()
.AddSingleton(typeof(IHostedService), provider => new StringWriter())
.BuildServiceProvider();
var hostedService = provider.GetService(typeof(IHostedService));Using the above code, you will get an instance without any inheritance or implementation relationship.
|
|
What is this fixing? Where is the issue and the unit test? Does this regress the performance in anyway? |
|
This pull request has been automatically marked |
|
This pull request will now be closed since it had been marked |
Using the above code, you will get an instance without any inheritance or implementation relationship.
I think we should throw an exception instead of getting an instance, which may cause problems in some cases.