Return the resulting service, not the Task

This commit is contained in:
Haselnussbomber 2025-10-19 23:30:25 +02:00
parent 46dee9a483
commit 9001c96986
No known key found for this signature in database
GPG key ID: BB905BB49E7295D1
2 changed files with 3 additions and 3 deletions

View file

@ -161,7 +161,7 @@ internal class ServiceContainer : IServiceProvider, IServiceType
public IServiceScope GetScope() => new ServiceScopeImpl(this);
/// <inheritdoc/>
object? IServiceProvider.GetService(Type serviceType) => this.GetSingletonService(serviceType);
public object? GetService(Type serviceType) => this.GetSingletonService(serviceType).Result;
private async Task<object> GetService(Type serviceType, ServiceScopeImpl? scope, object[] scopedObjects)
{

View file

@ -58,9 +58,9 @@ internal class ServiceScopeImpl : IServiceScope
public ServiceScopeImpl(ServiceContainer container) => this.container = container;
/// <inheritdoc/>
object? IServiceProvider.GetService(Type serviceType)
public object? GetService(Type serviceType)
{
return ((IServiceProvider)this.container).GetService(serviceType);
return this.container.GetService(serviceType);
}
/// <inheritdoc/>