563 references to GetService
Aspire.Azure.Messaging.EventHubs (1)
EventProcessorClientComponent.cs (1)
80provider.GetService<BlobServiceClient>();
Aspire.Components.Common.Tests (7)
ConformanceTests.cs (7)
108HealthCheckService? healthCheckService = host.Services.GetService<HealthCheckService>(); 146TracerProvider? tracer = host.Services.GetService<TracerProvider>(); 160MeterProvider? meter = host.Services.GetService<MeterProvider>(); 212? serviceProvider.GetService<TService>() 248Assert.Null(host.Services.GetService<TService>()); 392Assert.Null(host.Services.GetService<TracerProvider>()); 414Assert.Null(host.Services.GetService<HealthCheckService>());
Aspire.Elastic.Clients.Elasticsearch.Tests (1)
AspireElasticClientExtensionsTest.cs (1)
90var healthCheckService = host.Services.GetService<HealthCheckService>();
Aspire.Hosting (1)
Dashboard\DashboardServiceHost.cs (1)
203var addressFeature = _app.Services.GetService<IServer>()?.Features.Get<IServerAddressesFeature>();
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (3)
ConformanceTests.cs (2)
84IDbContextPool<TestDbContext>? pool = host.Services.GetService<IDbContextPool<TestDbContext>>(); 94TestDbContext? dbContext = host.Services.GetService<TestDbContext>();
EnrichCosmosDbTests.cs (1)
157var tracerProvider = host.Services.GetService<TracerProvider>();
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (2)
ConformanceTests.cs (2)
102IDbContextPool<TestDbContext>? pool = host.Services.GetService<IDbContextPool<TestDbContext>>(); 112TestDbContext? dbContext = host.Services.GetService<TestDbContext>();
Aspire.Milvus.Client.Tests (1)
AspireMilvusExtensionTests.cs (1)
168var healthCheckService = host.Services.GetService<HealthCheckService>();
Aspire.MongoDB.Driver (1)
AspireMongoDBDriverExtensions.cs (1)
196clientSettings.LoggingSettings ??= new LoggingSettings(serviceProvider.GetService<ILoggerFactory>());
Aspire.MongoDB.Driver.Tests (4)
AspireMongoDBDriverExtensionsTests.cs (3)
58var mongoDatabase = host.Services.GetService<IMongoDatabase>(); 154var healthCheckService = host.Services.GetService<HealthCheckService>(); 198var healthCheckService = host.Services.GetService<HealthCheckService>();
ConformanceTests.cs (1)
120T? Resolve<T>() => key is null ? host.Services.GetService<T>() : host.Services.GetKeyedService<T>(key);
Aspire.MySqlConnector.Tests (1)
ConformanceTests.cs (1)
123T? Resolve<T>() => key is null ? host.Services.GetService<T>() : host.Services.GetKeyedService<T>(key);
Aspire.NATS.Net.Tests (1)
AspireNatsClientExtensionsTests.cs (1)
202var healthCheckService = host.Services.GetService<HealthCheckService>();
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (3)
ConformanceTests.cs (2)
119IDbContextPool<TestDbContext>? pool = host.Services.GetService<IDbContextPool<TestDbContext>>(); 129TestDbContext? dbContext = host.Services.GetService<TestDbContext>();
EnrichNpgsqlTests.cs (1)
367var tracerProvider = host.Services.GetService<TracerProvider>();
Aspire.Npgsql.Tests (1)
ConformanceTests.cs (1)
125T? Resolve<T>() => key is null ? host.Services.GetService<T>() : host.Services.GetKeyedService<T>(key);
Aspire.Oracle.EntityFrameworkCore.Tests (3)
ConformanceTests.cs (2)
114IDbContextPool<TestDbContext>? pool = host.Services.GetService<IDbContextPool<TestDbContext>>(); 125TestDbContext? dbContext = host.Services.GetService<TestDbContext>();
EnrichOracleDatabaseTests.cs (1)
355var tracerProvider = host.Services.GetService<TracerProvider>();
Aspire.Pomelo.EntityFrameworkCore.MySql (1)
AspireEFMySqlExtensions.cs (1)
94if (serviceProvider.GetService<ILoggerFactory>() is { } loggerFactory)
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (4)
ConformanceTests.cs (2)
116IDbContextPool<TestDbContext>? pool = host.Services.GetService<IDbContextPool<TestDbContext>>(); 125TestDbContext? dbContext = host.Services.GetService<TestDbContext>();
EnrichMySqlTests.cs (2)
35if (serviceProvider.GetService<ILoggerFactory>() is { } loggerFactory) 368var tracerProvider = host.Services.GetService<TracerProvider>();
Aspire.Qdrant.Client.Tests (1)
AspireQdrantClientExtensionsTest.cs (1)
82var healthCheckService = host.Services.GetService<HealthCheckService>();
Aspire.StackExchange.Redis (3)
AspireRedisExtensions.cs (2)
147var instrumentation = serviceProvider.GetService<StackExchangeRedisInstrumentation>(); 165configurationOptions.LoggerFactory ??= serviceProvider.GetService<ILoggerFactory>();
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\TracerProviderBuilderExtensions.cs (1)
122connection ??= sp.GetService<IConnectionMultiplexer>();
BasicTestApp (2)
Program.cs (2)
51new PrependMessageLoggerProvider(builder.Configuration["Logging:PrependMessage:Message"], s.GetService<IJSRuntime>())); 67uri = new Uri(host.Services.GetService<NavigationManager>().Uri);
BasicWebSite (1)
RequestIdMiddleware.cs (1)
18var requestIdService = context.RequestServices.GetService<RequestIdService>();
DatabaseErrorPageSample (1)
Startup.cs (1)
24context.RequestServices.GetService<MyContext>().Blog.FirstOrDefault();
DependencyInjectionApp (1)
Program.cs (1)
30context.RequestServices.GetService<IService<IAnotherService>>();
Diagnostics.EFCore.FunctionalTests (11)
DatabaseErrorPageMiddlewareTest.cs (11)
120var db = context.RequestServices.GetService<BloggingContext>(); 158var db = context.RequestServices.GetService<BloggingContext>(); 174using (var db = server.Services.GetService<BloggingContext>()) 223var db = context.RequestServices.GetService<BloggingContextWithMigrations>(); 261var db = context.RequestServices.GetService<BloggingContextWithPendingModelChanges>(); 319var db = context.RequestServices.GetService<BloggingContextWithMigrations>(); 390app.ApplicationServices.GetService<ILoggerFactory>().AddProvider(logProvider); 423.UseLoggerFactory(context.RequestServices.GetService<ILoggerFactory>()) 469var db = context.RequestServices.GetService<BloggingContextWithSnapshotThatThrows>(); 503var db = context.RequestServices.GetService<BloggingContext>(); 536app.ApplicationServices.GetService<ILoggerFactory>().AddProvider(logProvider);
IIS.Tests (1)
Utilities\TestServer.cs (1)
166var lifetime = _host.Services.GetService<IHostApplicationLifetime>();
InProcessWebSite (12)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (12)
58private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().ContentRootPath); 60private async Task WebRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().WebRootPath); 73var config = ctx.RequestServices.GetService<IConfiguration>(); 107var serverAddresses = ctx.RequestServices.GetService<IServer>().Features.Get<IServerAddressesFeature>(); 132var authProvider = ctx.RequestServices.GetService<IAuthenticationSchemeProvider>(); 178var hostingEnv = context.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>(); 600var lifetime = ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IApplicationLifetime>(); 996ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IApplicationLifetime>().StopApplication(); 1005var server = ctx.RequestServices.GetService<IServer>(); 1012var server = ctx.RequestServices.GetService<IServer>(); 1133var httpsPort = context.RequestServices.GetService<IConfiguration>().GetValue<int?>("ANCM_HTTPS_PORT"); 1140var httpsPort = context.RequestServices.GetService<IConfiguration>().GetValue<int?>("HTTPS_PORT");
KeyManagementSample (1)
Program.cs (1)
34var keyManager = services.GetService<IKeyManager>();
Microsoft.AspNetCore.Authentication.Abstractions (1)
AuthenticationHttpContextExtensions.cs (1)
217context.RequestServices.GetService<IAuthenticationService>() ??
Microsoft.AspNetCore.Authentication.BearerToken (1)
BearerTokenHandler.cs (1)
86var typeInfo = httpContext.RequestServices.GetService<IOptions<JsonOptions>>()
Microsoft.AspNetCore.Authentication.Certificate (1)
CertificateAuthenticationHandler.cs (1)
44_cache = Context.RequestServices.GetService<ICertificateValidationCache>();
Microsoft.AspNetCore.Authentication.Test (1)
AuthenticationMiddlewareTests.cs (1)
179var options = app.Services.GetService<IOptionsMonitor<JwtBearerOptions>>().Get(JwtBearerDefaults.AuthenticationScheme);
Microsoft.AspNetCore.Authorization.Policy (1)
AuthorizationMiddleware.cs (1)
84_policyCache = services.GetService<AuthorizationPolicyCache>();
Microsoft.AspNetCore.Components (3)
RenderTree\Renderer.cs (2)
93ServiceProviderCascadingValueSuppliers = serviceProvider.GetService<ICascadingValueSupplier>() is null 104return serviceProvider.GetService<IComponentActivator>()
Routing\Router.cs (1)
108RoutingStateProvider = ServiceProvider.GetService<IRoutingStateProvider>();
Microsoft.AspNetCore.Components.Endpoints (6)
Builder\OpaqueRedirection.cs (1)
83if (httpContext.RequestServices.GetService<ILogger<OpaqueRedirection>>() is { } logger)
Builder\RazorComponentsEndpointRouteBuilderExtensions.cs (1)
59var marker = endpoints.ServiceProvider.GetService<RazorComponentsMarkerService>();
Rendering\EndpointHtmlRenderer.cs (3)
82var authenticationStateProvider = httpContext.RequestServices.GetService<AuthenticationStateProvider>(); 108if (httpContext.RequestServices.GetService<AntiforgeryStateProvider>() is EndpointAntiforgeryStateProvider antiforgery) 139var resourceCollectionProvider = resourceCollectionUrl != null ? httpContext.RequestServices.GetService<ResourceCollectionProvider>() : null;
Rendering\EndpointHtmlRenderer.EventDispatch.cs (1)
72return _httpContext.RequestServices.GetService<IHostEnvironment>()?.IsDevelopment() == true
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
RazorComponentEndpointDataSourceTest.cs (1)
239services?.GetService<IEnumerable<RenderModeEndpointProvider>>() ?? Enumerable.Empty<RenderModeEndpointProvider>(),
Microsoft.AspNetCore.Components.QuickGrid (1)
Infrastructure\AsyncQueryExecutorSupplier.cs (1)
32var executor = services.GetService<IAsyncQueryExecutor>();
Microsoft.AspNetCore.Components.Server (3)
Circuits\CircuitFactory.cs (1)
122var antiforgery = scope.ServiceProvider.GetService<AntiforgeryStateProvider>();
Circuits\CircuitHost.cs (2)
600var authenticationStateProvider = Services.GetService<AuthenticationStateProvider>() as IHostEnvironmentAuthenticationStateProvider; 812var antiforgery = scope.ServiceProvider.GetService<AntiforgeryStateProvider>();
Microsoft.AspNetCore.Components.Web (4)
Forms\AntiforgeryToken.cs (1)
23_requestToken = Services.GetService<AntiforgeryStateProvider>()?.GetAntiforgeryToken();
HtmlRendering\StaticHtmlRenderer.cs (3)
35_navigationManager = serviceProvider.GetService<NavigationManager>(); 36_htmlEncoder = serviceProvider.GetService<HtmlEncoder>() ?? HtmlEncoder.Default; 37_javaScriptEncoder = serviceProvider.GetService<JavaScriptEncoder>() ?? JavaScriptEncoder.Default;
Microsoft.AspNetCore.DataProtection (13)
ActivatorExtensions.cs (1)
38? (serviceProvider.GetService<IActivator>() ?? new SimpleActivator(serviceProvider))
DataProtectionBuilderExtensions.cs (6)
175var loggerFactory = services.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance; 199var loggerFactory = services.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance; 222var loggerFactory = services.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance; 257var loggerFactory = services.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance; 328var loggerFactory = services.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance; 382var loggerFactory = services.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance;
DataProtectionServiceCollectionExtensions.cs (1)
87var loggerFactory = s.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance;
DataProtectionUtilityExtensions.cs (1)
41discriminator = services.GetService<IApplicationDiscriminator>()?.Discriminator;
KeyManagement\KeyEscrowServiceProviderExtensions.cs (1)
20var escrowSinks = services?.GetService<IEnumerable<IKeyEscrowSink>>()?.ToList();
LoggingServiceProviderExtensions.cs (1)
40return services?.GetService<ILoggerFactory>()?.CreateLogger(type.FullName!) ?? NullLogger.Instance;
XmlEncryption\EncryptedXmlDecryptor.cs (2)
39_decryptor = services?.GetService<IInternalEncryptedXmlDecryptor>() ?? this; 40_options = services?.GetService<IOptions<XmlKeyDecryptionOptions>>()?.Value;
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (1)
EntityFrameworkCoreDataProtectionExtensions.cs (1)
29var loggerFactory = services.GetService<ILoggerFactory>() ?? NullLoggerFactory.Instance;
Microsoft.AspNetCore.DataProtection.Tests (2)
ServiceCollectionTests.cs (2)
26Assert.NotNull(services.GetService<IOptions<DataProtectionOptions>>()); 57Assert.Null(services.GetService<ILoggerFactory>());
Microsoft.AspNetCore.Diagnostics (2)
ExceptionHandler\ExceptionHandlerExtensions.cs (1)
109var problemDetailsService = app.ApplicationServices.GetService<IProblemDetailsService>();
StatusCodePage\StatusCodePagesOptions.cs (1)
26var problemDetailsService = context.HttpContext.RequestServices.GetService<IProblemDetailsService>();
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (6)
Latency\RequestLatencyTelemetryExtensionsTests.cs (5)
38Assert.NotNull(serviceProvider.GetService<ILatencyContext>()); 43Assert.Equal(scope1.ServiceProvider.GetService<ILatencyContext>(), 44scope1.ServiceProvider.GetService<ILatencyContext>()); 45Assert.NotEqual(scope1.ServiceProvider.GetService<ILatencyContext>(), 46scope2.ServiceProvider.GetService<ILatencyContext>());
Logging\HttpUtilityExtensionsTests.cs (1)
29var routeUtilities = sp.GetService<IIncomingHttpRouteUtility>();
Microsoft.AspNetCore.Grpc.Swagger (2)
GrpcSwaggerServiceExtensions.cs (2)
39var actionDescriptorCollectionProvider = serviceProvider.GetService<IActionDescriptorCollectionProvider>(); 50var serializerOptions = s.GetService<IOptions<JsonOptions>>()?.Value?.JsonSerializerOptions ?? new JsonSerializerOptions();
Microsoft.AspNetCore.HeaderPropagation (1)
DependencyInjection\HeaderPropagationApplicationBuilderExtensions.cs (1)
31if (app.ApplicationServices.GetService<HeaderPropagationValues>() == null)
Microsoft.AspNetCore.Hosting (11)
Http\DefaultHttpContextFactory.cs (1)
32_httpContextAccessor = serviceProvider.GetService<IHttpContextAccessor>();
Internal\WebHost.cs (5)
67=> services.GetService<ApplicationLifetime>()!); 70=> services.GetService<ApplicationLifetime>()!); 72=> services.GetService<ApplicationLifetime>()!); 189var startup = _hostingServiceProvider.GetService<IStartup>(); 213var startupFilters = _applicationServices.GetService<IEnumerable<IStartupFilter>>();
WebHostBuilder.cs (4)
174_ = host.Services.GetService<IConfiguration>(); 201var factory = provider.GetService<IServiceProviderFactory<IServiceCollection>>(); 354var listener = hostingServiceProvider.GetService<DiagnosticListener>(); 358var activitySource = hostingServiceProvider.GetService<ActivitySource>();
WebHostExtensions.cs (1)
114var hostingEnvironment = host.Services.GetService<IHostEnvironment>();
Microsoft.AspNetCore.Hosting.Tests (42)
WebHostBuilderTests.cs (26)
208Assert.NotNull(host.Services.GetService<ILoggerFactory>()); 369Assert.NotNull(host.Services.GetService<IConfiguration>()); 410var config = host.Services.GetService<IConfiguration>(); 611Assert.Equal(expected, host.Services.GetService<IHostEnvironment>().EnvironmentName); 612Assert.Equal(expected, host.Services.GetService<IWebHostEnvironment>().EnvironmentName); 614Assert.Equal(expected, host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>().EnvironmentName); 615Assert.Equal(expected, host.Services.GetService<Extensions.Hosting.IHostingEnvironment>().EnvironmentName); 659Assert.Equal("/", host.Services.GetService<IHostEnvironment>().ContentRootPath); 660Assert.Equal("/", host.Services.GetService<IWebHostEnvironment>().ContentRootPath); 662Assert.Equal("/", host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>().ContentRootPath); 663Assert.Equal("/", host.Services.GetService<Extensions.Hosting.IHostingEnvironment>().ContentRootPath); 680var basePath2 = host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>().ContentRootPath; 701Assert.Equal(appBase, host.Services.GetService<IHostEnvironment>().ContentRootPath); 703Assert.Equal(appBase, host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>().ContentRootPath); 732var hostingEnv = host.Services.GetService<IHostEnvironment>(); 734var hostingEnv2 = host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>(); 750var hostingEnv = host.Services.GetService<IHostEnvironment>(); 752var hostingEnv2 = host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>(); 768var hostingEnv = host.Services.GetService<IHostEnvironment>(); 781var hostingEnv = host.Services.GetService<IHostEnvironment>(); 797var hostingEnv = host.Services.GetService<IHostEnvironment>(); 813var hostingEnv = host.Services.GetService<IHostEnvironment>(); 827var hostingEnv = host.Services.GetService<IHostEnvironment>(); 879var factoryFromHost = host.Services.GetService<ILoggerFactory>(); 1067var loggerFactory = app.ApplicationServices.GetService<ILoggerFactory>(); 1658ServiceA = app.ApplicationServices.GetService<ServiceA>();
WebHostTests.cs (16)
384var singleton = (FakeService)host.Services.GetService<IFakeSingletonService>(); 385var transient = (FakeService)host.Services.GetService<IFakeService>(); 409var applicationLifetime = host.Services.GetService<IHostApplicationLifetime>(); 411var applicationLifetime2 = host.Services.GetService<AspNetCore.Hosting.IApplicationLifetime>(); 430var applicationLifetime = host.Services.GetService<IHostApplicationLifetime>(); 432var applicationLifetime2 = host.Services.GetService<AspNetCore.Hosting.IApplicationLifetime>(); 680var applicationLifetime = host.Services.GetService<IHostApplicationLifetime>(); 682var applicationLifetime2 = host.Services.GetService<AspNetCore.Hosting.IApplicationLifetime>(); 714var env = host.Services.GetService<IHostEnvironment>(); 716var env2 = host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>(); 801var env = host.Services.GetService<IHostEnvironment>(); 803var env2 = host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>(); 824var env = host.Services.GetService<IHostEnvironment>(); 826var env2 = host.Services.GetService<AspNetCore.Hosting.IHostingEnvironment>(); 847var env = host.Services.GetService<IWebHostEnvironment>(); 852var env1 = host.Services.GetService<IHostingEnvironment>();
Microsoft.AspNetCore.Http (2)
Internal\ResponseCookies.cs (2)
54_logger = services?.GetService<ILogger<ResponseCookies>>(); 78_logger = services?.GetService<ILogger<ResponseCookies>>();
Microsoft.AspNetCore.Http.Connections.Tests (7)
HttpConnectionDispatcherTests.cs (6)
3252var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3315var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3414var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3464var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3538var url = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single(); 3917var message = context.RequestServices.GetService<MessageWrapper>();
MapConnectionHandlerTests.cs (1)
396var feature = host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>();
Microsoft.AspNetCore.Http.Extensions (4)
HttpRequestJsonExtensions.cs (1)
306return httpContext.RequestServices?.GetService<IOptions<JsonOptions>>()?.Value?.SerializerOptions ?? JsonOptions.DefaultSerializerOptions;
HttpResponseJsonExtensions.cs (1)
345return httpContext.RequestServices?.GetService<IOptions<JsonOptions>>()?.Value?.SerializerOptions ?? JsonOptions.DefaultSerializerOptions;
RequestDelegateFactory.cs (2)
276var jsonSerializerOptions = serviceProvider.GetService<IOptions<JsonOptions>>()?.Value.SerializerOptions ?? JsonOptions.DefaultSerializerOptions; 283ServiceProviderIsService = serviceProvider.GetService<IServiceProviderIsService>(),
Microsoft.AspNetCore.Http.Extensions.Tests (6)
ProblemDetailsServiceCollectionExtensionsTest.cs (6)
98var jsonOptions = services.GetService<IOptions<JsonOptions>>(); 123var jsonOptions = services.GetService<IOptions<JsonOptions>>(); 163var jsonOptions = services.GetService<IOptions<JsonOptions>>(); 184var jsonOptions = services.GetService<IOptions<JsonOptions>>(); 204var jsonOptions = services.GetService<IOptions<JsonOptions>>(); 229var jsonOptions = services.GetService<IOptions<JsonOptions>>();
Microsoft.AspNetCore.Http.Results (3)
HttpResultsHelper.cs (1)
153return httpContext.RequestServices.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
ProblemHttpResult.cs (1)
55var problemDetailsService = httpContext.RequestServices.GetService<IProblemDetailsService>();
ValidationProblem.cs (1)
58var problemDetailsService = httpContext.RequestServices.GetService<IProblemDetailsService>();
Microsoft.AspNetCore.Http.Tests (1)
DefaultHttpContextTests.cs (1)
538var scope = new AsyncServiceScope(_serviceProvider.GetService<IServiceScopeFactory>().CreateScope());
Microsoft.AspNetCore.HttpLogging (2)
HttpLoggingBuilderExtensions.cs (2)
48var serviceProviderIsService = app.ApplicationServices.GetService<IServiceProviderIsService>(); 60var serviceProviderIsService = app.ApplicationServices.GetService<IServiceProviderIsService>();
Microsoft.AspNetCore.Identity (1)
AspNetUserManager.cs (1)
42_cancel = services?.GetService<IHttpContextAccessor>()?.HttpContext?.RequestAborted ?? CancellationToken.None;
Microsoft.AspNetCore.Identity.EntityFrameworkCore (1)
IdentityUserContext.cs (1)
106?.GetService<IOptions<IdentityOptions>>()
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (1)
UserStoreEncryptPersonalDataTest.cs (1)
199var manager = scope.ServiceProvider.GetService<UserManager<CustomUser>>();
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Infrastructure\ServerFactory.cs (1)
77scope.ServiceProvider.GetService<TContext>()?.Database?.EnsureCreated();
Microsoft.AspNetCore.Identity.Specification.Tests (2)
IdentitySpecificationTestBase.cs (1)
91return services.BuildServiceProvider().GetService<RoleManager<TRole>>();
UserManagerSpecificationTests.cs (1)
90return services.BuildServiceProvider().GetService<UserManager<TUser>>();
Microsoft.AspNetCore.Identity.Test (8)
IdentityBuilderTest.cs (4)
49Assert.Null(sp.GetService<IRoleStore<PocoRole>>()); 50Assert.Throws<InvalidOperationException>(() => sp.GetService<RoleManager<PocoRole>>()); 215Assert.NotNull(provider.GetService<IOptions<SecurityStampValidatorOptions>>()); 235Assert.NotNull(provider.GetService<IOptions<SecurityStampValidatorOptions>>());
UserManagerTest.cs (4)
800var manager = services.BuildServiceProvider().GetService<UserManager<PocoUser>>(); 811var e = Assert.Throws<InvalidOperationException>(() => services.BuildServiceProvider().GetService<UserManager<PocoUser>>()); 822var e = Assert.Throws<InvalidOperationException>(() => services.BuildServiceProvider().GetService<UserManager<PocoUser>>()); 897var manager = services.BuildServiceProvider().GetService<UserManager<PocoUser>>();
Microsoft.AspNetCore.Mvc.Core (5)
ApplicationModels\ApiBehaviorApplicationModelProvider.cs (1)
49var serviceProviderIsService = serviceProvider.GetService<IServiceProviderIsService>();
Builder\ControllerEndpointRouteBuilderExtensions.cs (1)
518var marker = endpoints.ServiceProvider.GetService<MvcMarkerService>();
Formatters\TextOutputFormatter.cs (1)
133if (context.HttpContext.RequestServices.GetService<IProblemDetailsService>() is { } problemDetailsService)
Infrastructure\ObjectResultExecutor.cs (1)
104if (context.HttpContext.RequestServices.GetService<IProblemDetailsService>() is { } problemDetailsService)
ModelBinding\DefaultModelBindingContext.cs (1)
235var mvcOptions = actionContext.HttpContext.RequestServices?.GetService<IOptions<MvcOptions>>();
Microsoft.AspNetCore.Mvc.Core.Test (1)
ModelBinding\Validation\DefaultObjectValidatorTests.cs (1)
599var receivedService = context.GetService<IExampleService>();
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
DataAnnotationsModelValidatorTest.cs (1)
412var receivedService = context.GetService<IExampleService>();
Microsoft.AspNetCore.Mvc.IntegrationTests (2)
ParameterBinderExtensions.cs (2)
21var optionsAccessor = context.HttpContext.RequestServices.GetService<IOptions<MvcOptions>>(); 23var modelMetadataProvider = context.HttpContext.RequestServices.GetService<IModelMetadataProvider>();
Microsoft.AspNetCore.Mvc.Razor (1)
DefaultTagHelperFactory.cs (1)
76var initializers = serviceProvider.GetService<IEnumerable<ITagHelperInitializer<TTagHelper>>>()!;
Microsoft.AspNetCore.Mvc.RazorPages (1)
Builder\RazorPagesEndpointRouteBuilderExtensions.cs (1)
364var marker = endpoints.ServiceProvider.GetService<PageActionEndpointDataSourceFactory>();
Microsoft.AspNetCore.Mvc.ViewFeatures (4)
PartialViewResult.cs (1)
65var executor = services.GetService<IActionResultExecutor<PartialViewResult>>();
RemoteAttributeBase.cs (1)
181var factory = services.GetService<IStringLocalizerFactory>();
ViewComponentResult.cs (1)
64var executor = services.GetService<IActionResultExecutor<ViewComponentResult>>();
ViewResult.cs (1)
64var executor = context.HttpContext.RequestServices.GetService<IActionResultExecutor<ViewResult>>();
Microsoft.AspNetCore.OpenApi (2)
Extensions\OpenApiEndpointConventionBuilderExtensions.cs (2)
106var hostEnvironment = applicationServices.GetService<IHostEnvironment>(); 107var serviceProviderIsService = applicationServices.GetService<IServiceProviderIsService>();
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiDocumentServiceTestsBase.cs (1)
129var jsonOptions = builder.ServiceProvider.GetService<IOptions<Microsoft.AspNetCore.Http.Json.JsonOptions>>() ?? Options.Create(new Microsoft.AspNetCore.Http.Json.JsonOptions());
Microsoft.AspNetCore.Owin.Tests (4)
OwinExtensionTests.cs (4)
37fakeService = context.RequestServices.GetService<FakeService>(); 49Assert.NotNull(serviceProvider.GetService<FakeService>()); 71fakeService = context.RequestServices.GetService<FakeService>(); 105fakeService = context.RequestServices.GetService<FakeService>();
Microsoft.AspNetCore.RateLimiting (1)
RateLimiterApplicationBuilderExtensions.cs (1)
48var serviceProviderIsService = app.ApplicationServices.GetService<IServiceProviderIsService>();
Microsoft.AspNetCore.Routing (2)
Builder\EndpointRouteBuilderExtensions.cs (1)
458var routeHandlerOptions = endpoints.ServiceProvider?.GetService<IOptions<RouteHandlerOptions>>();
RequestDelegateFilterPipelineBuilder.cs (1)
22var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
Microsoft.AspNetCore.Routing.FunctionalTests (2)
Benchmarks\EndpointRoutingBenchmarkTest.cs (1)
28var configuration = _host.Services.GetService<IConfiguration>();
Benchmarks\RouterBenchmarkTest.cs (1)
29var configuration = _host.Services.GetService<IConfiguration>();
Microsoft.AspNetCore.Routing.Tests (1)
RoutingServiceCollectionExtensionsTests.cs (1)
79var options = provider.GetService<IOptions<RouteOptions>>();
Microsoft.AspNetCore.Server.IIS (1)
Core\IISServerSetupFilter.cs (1)
17var server = app.ApplicationServices.GetService<IServer>();
Microsoft.AspNetCore.Server.IISIntegration.Tests (3)
IISMiddlewareTests.cs (3)
320var configuration = host.Services.GetService<IConfiguration>(); 349var configuration = host.Services.GetService<IConfiguration>(); 450var auth = context.RequestServices.GetService<IAuthenticationSchemeProvider>();
Microsoft.AspNetCore.Server.Kestrel.Tests (1)
WebHostBuilderKestrelExtensionsTests.cs (1)
110Assert.IsType<KestrelServerImpl>(hostBuilder.Build().Services.GetService<IServer>());
Microsoft.AspNetCore.SignalR (1)
HubEndpointRouteBuilderExtensions.cs (1)
41var marker = endpoints.ServiceProvider.GetService<SignalRMarkerService>();
Microsoft.AspNetCore.SignalR.Client.Core (5)
HubConnection.cs (3)
243_activitySource = (serviceProvider.GetService<SignalRClientActivitySource>() ?? SignalRClientActivitySource.Instance).ActivitySource; 246var options = serviceProvider.GetService<IOptions<HubConnectionOptions>>(); 2162_hubConnection._serviceProvider.GetService<IOptions<HubConnectionOptions>>()?.Value.StatefulReconnectBufferSize
HubConnectionBuilder.cs (2)
49var connectionFactory = serviceProvider.GetService<IConnectionFactory>() ?? 52var endPoint = serviceProvider.GetService<EndPoint>() ??
Microsoft.AspNetCore.SignalR.Client.Tests (11)
HubConnectionBuilderExtensionsTests.cs (8)
27var value = serviceProvider.GetService<IOptions<HttpConnectionOptions>>().Value; 40var value = serviceProvider.GetService<IOptions<HttpConnectionOptions>>().Value; 54var value = serviceProvider.GetService<IOptions<HttpConnectionOptions>>().Value; 70var value = serviceProvider.GetService<IOptions<HttpConnectionOptions>>().Value; 85var value = serviceProvider.GetService<IOptions<HttpConnectionOptions>>().Value; 96var loggerFactory = serviceProvider.GetService<ILoggerFactory>(); 108var resolvedHubProtocol = serviceProvider.GetService<IHubProtocol>(); 121var resolvedHubProtocol = serviceProvider.GetService<IHubProtocol>();
HubConnectionBuilderTests.cs (3)
41var actualProtocol = Assert.IsType<NewtonsoftJsonHubProtocol>(serviceProvider.GetService<IHubProtocol>()); 56var actualProtocol = Assert.IsType<NewtonsoftJsonHubProtocol>(serviceProvider.GetService<IHubProtocol>()); 78Assert.IsType<MessagePackHubProtocol>(serviceProvider.GetService<IHubProtocol>());
Microsoft.AspNetCore.SignalR.Core (4)
Internal\DefaultHubActivator.cs (1)
27var hub = _serviceProvider.GetService<THub>();
Internal\DefaultHubDispatcher.cs (3)
777serviceProviderIsService = scope.ServiceProvider.GetService<IServiceProviderIsService>(); 836var activitySource = serviceProvider.GetService<SignalRServerActivitySource>()?.ActivitySource; 862var propagator = serviceProvider.GetService<DistributedContextPropagator>() ?? DistributedContextPropagator.Current;
Microsoft.AspNetCore.SignalR.Microbenchmarks (1)
DefaultHubDispatcherBenchmark.cs (1)
30var serviceScopeFactory = provider.GetService<IServiceScopeFactory>();
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
RedisDependencyInjectionExtensionsTests.cs (1)
27var options = provider.GetService<IOptions<RedisOptions>>();
Microsoft.AspNetCore.SignalR.Tests (173)
HubConnectionHandlerTests.Activity.cs (8)
48var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 123var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 192var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 251var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 324var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnConnectedThrowsHub>>(); 371var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnDisconnectedThrowsHub>>(); 423var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 474var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>();
HubConnectionHandlerTests.ClientResult.cs (13)
19var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 52var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 84var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnConnectedClientResultHub>>(); 111var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnDisconnectedClientResultHub>>(); 136var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 168var connectionHandler = serviceProvider.GetService<HubConnectionHandler<HubT>>(); 202var connectionHandler = serviceProvider.GetService<HubConnectionHandler<HubT>>(); 237var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 291var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 360var connectionHandler = serviceProvider.GetService<HubConnectionHandler<HubT>>(); 405var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 450var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 487var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>();
HubConnectionHandlerTests.cs (134)
45var connectionHandler = serviceProvider.GetService<HubConnectionHandler<DisposeTrackingHub>>(); 73var connectionHandler = serviceProvider.GetService<HubConnectionHandler<HubWithAsyncDisposable>>(); 99var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>(); 123var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ErrorInAbortedTokenHub>>(); 149var connectionHandler = serviceProvider.GetService<HubConnectionHandler<AbortHub>>(); 173var connectionHandler = serviceProvider.GetService<HubConnectionHandler<SimpleHub>>(); 201var connectionHandler = serviceProvider.GetService<HubConnectionHandler<SimpleHub>>(); 704var connectionHandler = serviceProvider.GetService<HubConnectionHandler<Hub>>(); 745var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnConnectedThrowsHub>>(); 777var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnDisconnectedThrowsHub>>(); 800var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 826var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 852var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 922var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 991var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1016var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1045var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1070var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1096var connectionHandler = serviceProvider.GetService<HubConnectionHandler<InheritedHub>>(); 1131var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1159var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1184var connectionHandler = serviceProvider.GetService<HubConnectionHandler<InheritedHub>>(); 1209var connectionHandler = serviceProvider.GetService<HubConnectionHandler<InheritedHub>>(); 1234var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1261var connectionHandler = serviceProvider.GetService<HubConnectionHandler<InvalidHub>>(); 1278var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1303var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1336var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1361var exception = Assert.Throws<NotSupportedException>(() => serviceProvider.GetService<HubConnectionHandler<GenericMethodHub>>()); 1411var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1884var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2010var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 2045var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 2094var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 2129var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2205var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2241var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2280var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2343var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2387var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2417var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2455var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2493var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2517var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2550var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2614var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2645var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2669var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2698var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2744var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2806var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2842var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2875var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>(); 2905var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3019var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 3078var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 3105var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3148var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnConnectedThrowsHub>>(); 3183var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 3218var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 3232var hubActivator = serviceProvider.GetService<IHubActivator<StreamingHub>>() as CustomHubActivator<StreamingHub>; 3253var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 3267var hubActivator = serviceProvider.GetService<IHubActivator<StreamingHub>>() as CustomHubActivator<StreamingHub>; 3288var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 3303var hubActivator = serviceProvider.GetService<IHubActivator<StreamingHub>>() as CustomHubActivator<StreamingHub>; 3330var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 3385var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 3441var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 3512var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 3532var hubActivator = serviceProvider.GetService<IHubActivator<LongRunningHub>>() as CustomHubActivator<LongRunningHub>; 3560var connectionHandler = serviceProvider.GetService<HubConnectionHandler<SimpleHub>>(); 3597var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3621var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3644var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3672var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3736var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3772var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 3802var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3821var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>(); 3844var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>(); 3868var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3919var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3946var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3971var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3995var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4015var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4034var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4056var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4072var hubActivator = serviceProvider.GetService<IHubActivator<MethodHub>>() as CustomHubActivator<MethodHub>; 4094var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4100var hubActivator = serviceProvider.GetService<IHubActivator<MethodHub>>() as CustomHubActivator<MethodHub>; 4131var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4168var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4214var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 4255var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 4300var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 4331var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 4358var connectionHandler = serviceProvider.GetService<HubConnectionHandler<LongRunningHub>>(); 4384var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4409HubConnectionHandler<StreamingHub> connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 4477var connectionHandler = serviceProvider.GetService<HubConnectionHandler<StreamingHub>>(); 4511var connectionHandler = serviceProvider.GetService<HubConnectionHandler<CallerServiceHub>>(); 4538var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4563var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4605var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4628var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4656var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4673var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4692var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4711var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4736var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4758var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4779var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4800var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4825var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4848var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4870var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4890var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4910var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ServicesHub>>(); 4933var connectionHandler = serviceProvider.GetService<HubConnectionHandler<KeyedServicesHub>>(); 4956var connectionHandler = serviceProvider.GetService<HubConnectionHandler<KeyedServicesHub>>(); 4980var connectionHandler = serviceProvider.GetService<HubConnectionHandler<KeyedServicesHub>>(); 5003var connectionHandler = serviceProvider.GetService<HubConnectionHandler<KeyedServicesHub>>(); 5026var connectionHandler = serviceProvider.GetService<HubConnectionHandler<KeyedServicesHub>>(); 5046var ex = Assert.Throws<InvalidOperationException>(() => serviceProvider.GetService<HubConnectionHandler<KeyedServicesHub>>()); 5062var ex = Assert.Throws<InvalidOperationException>(() => serviceProvider.GetService<HubConnectionHandler<BadServicesHub>>()); 5074() => serviceProvider.GetService<HubConnectionHandler<TooManyParamsHub>>()); 5087var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnConnectedSendToClientHub>>(); 5117var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>(); 5141var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>(); 5172var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 5200var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 5245var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>(); 5308var connectionHandler = serviceProvider.GetService<HubConnectionHandler<ConnectionLifetimeHub>>();
HubFilterTests.cs (18)
114var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 153var connectionHandler = serviceProvider.GetService<HubConnectionHandler<DynamicTestHub>>(); 188var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 238var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 289var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 337var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 397var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 459var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 539var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 588var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 631var connectionHandler = serviceProvider.GetService<HubConnectionHandler<OnConnectedThrowsHub>>(); 662var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 692var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 729var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 770var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 805var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 846var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 884var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>();
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
src\Shared\SignalR\InProcessTestServer.cs (1)
129_url = _host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.Single();
Microsoft.AspNetCore.SpaServices.Extensions (4)
SpaApplicationBuilderExtensions.cs (1)
34var optionsProvider = app.ApplicationServices.GetService<IOptions<SpaOptions>>()!;
StaticFiles\SpaStaticFilesExtensions.cs (2)
30var optionsProvider = serviceProvider.GetService<IOptions<SpaStaticFilesOptions>>()!; 110var spaStaticFilesService = app.ApplicationServices.GetService<ISpaStaticFileProvider>();
Util\LoggerFinder.cs (1)
18var loggerFactory = appBuilder.ApplicationServices.GetService<ILoggerFactory>();
Microsoft.AspNetCore.StaticFiles.FunctionalTests (3)
Helpers.cs (1)
15return server.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses.First();
StaticFileMiddlewareTests.cs (2)
154var hostingEnvironment = host.Services.GetService<IWebHostEnvironment>(); 196var hostingEnvironment = host.Services.GetService<IWebHostEnvironment>();
Microsoft.AspNetCore.TestHost.Tests (5)
TestServerTests.cs (5)
87Assert.IsType<NoopHostLifetime>(host.Services.GetService<IHostLifetime>()); 335Assert.Equal(testService, testServer.Services.GetService<TestService>()); 358Assert.Equal(testService, testServer.Services.GetService<TestService>()); 430var service = context.RequestServices.GetService<TestService>(); 914var service = app.ApplicationServices.GetService<SimpleService>();
Microsoft.AspNetCore.Testing (1)
ServiceFakesHostExtensions.cs (1)
45var certificate = host.Services.GetService<IOptions<FakeCertificateOptions>>()?.Value.Certificate;
Microsoft.AspNetCore.Tests (4)
WebApplicationTests.cs (3)
1388var config = sp.GetService<IConfiguration>(); 1405var config = sp.GetService<IConfiguration>(); 1533var config = serviceProvider.GetService<IConfiguration>();
WebHostTests.cs (1)
121var routeOptions = host.Services.GetService<IOptions<RouteOptions>>();
Microsoft.AspNetCore.WebSockets.Tests (1)
IHostPortExtensions.cs (1)
26return host.Services.GetService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
Microsoft.Extensions.Caching.Hybrid (3)
Internal\DefaultHybridCache.cs (2)
64_logger = services.GetService<ILoggerFactory>()?.CreateLogger(typeof(HybridCache)) ?? NullLogger.Instance; 66_backendCache = services.GetService<IDistributedCache>(); // note optional
Internal\DefaultHybridCache.Serialization.cs (1)
31var serializer = @this._services.GetService<IHybridCacheSerializer<T>>();
Microsoft.Extensions.Caching.Hybrid.Tests (6)
DistributedCacheTests.cs (4)
60var cache = (await InitAsync()).BuildServiceProvider().GetService<IDistributedCache>(); 106var cache = (await InitAsync()).BuildServiceProvider().GetService<IDistributedCache>(); 172var cache = (await InitAsync()).BuildServiceProvider().GetService<IDistributedCache>() as IBufferDistributedCache; 234var cache = (await InitAsync()).BuildServiceProvider().GetService<IDistributedCache>() as IBufferDistributedCache;
ServiceConstructionTests.cs (2)
31Assert.IsType<DefaultHybridCache>(provider.GetService<HybridCache>()); 44var obj = Assert.IsType<DefaultHybridCache>(provider.GetService<HybridCache>());
Microsoft.Extensions.Compliance.Redaction.Tests (1)
RedactionAcceptanceTests.cs (1)
48var redactorProvider = services.GetService<IRedactorProvider>();
Microsoft.Extensions.DependencyInjection.Abstractions (1)
ActivatorUtilities.cs (1)
86IServiceProviderIsService? serviceProviderIsService = provider.GetService<IServiceProviderIsService>();
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (10)
Linux\AcceptanceTest.cs (4)
130var provider = services.GetService<ISnapshotProvider>(); 178var provider = services.GetService<ISnapshotProvider>(); 237var tracker = host.Services.GetService<IResourceMonitor>(); 321var tracker = host.Services.GetService<IResourceMonitor>();
ResourceMonitoringExtensionsTests.cs (6)
103var tracker = host.Services.GetService<IResourceMonitor>(); 104var options = host.Services.GetService<IOptions<ResourceMonitoringOptions>>(); 105var provider = host.Services.GetService<ISnapshotProvider>(); 106var publisher = host.Services.GetService<IResourceUtilizationPublisher>(); 135var options = host.Services.GetService<IOptions<ResourceMonitoringOptions>>(); 175var options = host.Services.GetService<IOptions<ResourceMonitoringOptions>>();
Microsoft.Extensions.Diagnostics.Testing (1)
Logging\FakeLoggerServiceProviderExtensions.cs (1)
21=> services.GetService<FakeLogCollector>() ?? throw new InvalidOperationException("No fake log collector registered");
Microsoft.Extensions.Diagnostics.Testing.Tests (3)
Logging\FakeLoggerExtensionsTests.cs (3)
22var factory = serviceProvider.GetService<ILoggerFactory>(); 38var factory = serviceProvider.GetService<ILoggerFactory>(); 66var factory = serviceProvider.GetService<ILoggerFactory>()!;
Microsoft.Extensions.Hosting (1)
HostBuilder.cs (1)
375_ = serviceProvider.GetService<IConfiguration>();
Microsoft.Extensions.Hosting.Testing.Tests (4)
FakeHostBuilderTests.cs (3)
47Assert.NotNull(hostBuilderServices.GetService<FakeLogCollector>()); 48Assert.IsType<FakeLogger>(hostBuilderServices.GetService<ILogger>()); 56Assert.Null(hostBuilderServices.GetService<FakeLogCollector>());
FakeHostTests.cs (1)
36Assert.Throws<ObjectDisposedException>(() => host.Services.GetService<IHost>());
Microsoft.Extensions.Http (1)
DefaultHttpMessageHandlerBuilder.cs (1)
71if (Services.GetService<IOptionsMonitor<HttpClientFactoryOptions>>() is IOptionsMonitor<HttpClientFactoryOptions> optionsMonitor)
Microsoft.Extensions.Http.Diagnostics.Tests (8)
Logging\AcceptanceTests.cs (4)
240var firstClient = provider.GetService<ITestHttpClient1>() as TestHttpClient1; 241var secondClient = provider.GetService<ITestHttpClient2>() as TestHttpClient2; 501var firstClient = provider.GetService<ITestHttpClient1>() as TestHttpClient1; 502var secondClient = provider.GetService<ITestHttpClient2>() as TestHttpClient2;
Logging\HttpClientLoggerTest.cs (1)
1016return builder.GetService<IHttpRouteFormatter>()!;
Logging\HttpClientLoggingExtensionsTest.cs (1)
248var enricherRegistered = provider.GetService<IHttpClientLogEnricher>();
TelemetryCommonExtensionsTests.cs (2)
66var requestMetadataContext = sp.GetService<IOutgoingRequestContext>(); 90var requestMetadataContext = sp.GetService<IOutgoingRequestContext>()!;
Microsoft.Extensions.Http.Polly (1)
DependencyInjection\PollyServiceCollectionExtensions.cs (1)
32var registry = services.BuildServiceProvider().GetService<IPolicyRegistry<string>>();
Microsoft.Extensions.Http.Polly.Tests (12)
DependencyInjection\PollyHttpClientBuilderExtensionsTest.cs (12)
452var registry = services.GetService<IPolicyRegistry<string>>(); 456Assert.Same(registry, services.GetService<IConcurrentPolicyRegistry<string>>()); 457Assert.Same(registry, services.GetService<IReadOnlyPolicyRegistry<string>>()); 472Assert.Same(registry, services.GetService<IConcurrentPolicyRegistry<string>>()); 473Assert.Same(registry, services.GetService<IPolicyRegistry<string>>()); 474Assert.Same(registry, services.GetService<IReadOnlyPolicyRegistry<string>>()); 489var registry = services.GetService<IPolicyRegistry<string>>(); 493Assert.Same(registry, services.GetService<IConcurrentPolicyRegistry<string>>()); 494Assert.Same(registry, services.GetService<IReadOnlyPolicyRegistry<string>>()); 514Assert.Same(existingRegistry, services.GetService<IPolicyRegistry<string>>()); 515Assert.Same(existingRegistry, services.GetService<IConcurrentPolicyRegistry<string>>()); 516Assert.Same(existingRegistry, services.GetService<IReadOnlyPolicyRegistry<string>>());
Microsoft.Extensions.Identity.Core (5)
UserManager.cs (5)
128if (services?.GetService<ILookupProtector>() == null) 543var keyRing = _services.GetService<ILookupProtectorKeyRing>(); 544var protector = _services.GetService<ILookupProtector>(); 1298var keyRing = _services.GetService<ILookupProtectorKeyRing>(); 1299var protector = _services.GetService<ILookupProtector>();
Microsoft.Extensions.ObjectPool.DependencyInjection (1)
ObjectPoolServiceCollectionExtensions.cs (1)
113var options = provider.GetService<IOptionsFactory<DependencyInjectionPoolOptions>>()?.Create(typeof(TService).FullName!) ?? new DependencyInjectionPoolOptions();
Microsoft.Extensions.ObjectPool.DependencyInjection.Tests (4)
DependencyInjectionExtensionsTests.cs (4)
89var pool = services.BuildServiceProvider(validateScopes: true).GetService<ObjectPool<TestDependency>>(); 117var pool = services.BuildServiceProvider().GetService<ObjectPool<TestDependency>>(); 133var pool = provider.GetService<ObjectPool<ITestClass>>(); 147var pool = provider.GetService<ObjectPool<ITestClass>>();
Microsoft.Extensions.Telemetry.Abstractions.Tests (1)
Latency\LatencyRegistryExtensionsTests.cs (1)
45var option = serviceProvider.GetService<IOptions<LatencyContextRegistrationOptions>>();
Microsoft.Extensions.WebEncoders (1)
EncoderServiceCollectionExtensions.cs (1)
67?.GetService<IOptions<WebEncoderOptions>>()
Microsoft.ML.AutoML (25)
API\AutoMLExperimentExtension.cs (2)
163var channel = service.GetService<IChannel>(); 319var metricManager = serviceProvider.GetService<IMetricManager>();
API\BinaryClassificationExperiment.cs (6)
193var channel = provider.GetService<IChannel>(); 194var pipeline = provider.GetService<SweepablePipeline>(); 226var channel = provider.GetService<IChannel>(); 227var pipeline = provider.GetService<SweepablePipeline>(); 280var channel = provider.GetService<IChannel>(); 281var pipeline = provider.GetService<SweepablePipeline>();
API\MulticlassClassificationExperiment.cs (6)
178var channel = provider.GetService<IChannel>(); 179var pipeline = provider.GetService<SweepablePipeline>(); 213var channel = provider.GetService<IChannel>(); 214var pipeline = provider.GetService<SweepablePipeline>(); 270var channel = provider.GetService<IChannel>(); 271var pipeline = provider.GetService<SweepablePipeline>();
API\RegressionExperiment.cs (6)
166var channel = provider.GetService<IChannel>(); 167var pipeline = provider.GetService<SweepablePipeline>(); 207var channel = provider.GetService<IChannel>(); 208var pipeline = provider.GetService<SweepablePipeline>(); 263var channel = provider.GetService<IChannel>(); 264var pipeline = provider.GetService<SweepablePipeline>();
AutoMLExperiment\AutoMLExperiment.cs (5)
234var monitor = serviceProvider.GetService<IMonitor>(); 235var trialResultManager = serviceProvider.GetService<ITrialResultManager>(); 237serviceProvider.GetService<ITrialRunner>(); 238var tuner = serviceProvider.GetService<ITuner>(); 262using (var performanceMonitor = serviceProvider.GetService<IPerformanceMonitor>())
Microsoft.ML.AutoML.Tests (10)
AutoMLExperimentTests.cs (10)
41var channel = serviceProvider.GetService<IChannel>(); 42var settings = serviceProvider.GetService<AutoMLExperiment.AutoMLExperimentSettings>(); 80var channel = serviceProvider.GetService<IChannel>(); 81var settings = serviceProvider.GetService<AutoMLExperiment.AutoMLExperimentSettings>(); 128var channel = serviceProvider.GetService<IChannel>(); 129var settings = serviceProvider.GetService<AutoMLExperiment.AutoMLExperimentSettings>(); 167var channel = serviceProvider.GetService<IChannel>(); 168var settings = serviceProvider.GetService<AutoMLExperiment.AutoMLExperimentSettings>(); 190var channel = serviceProvider.GetService<IChannel>(); 191var settings = serviceProvider.GetService<AutoMLExperiment.AutoMLExperimentSettings>();
Microsoft.ML.Fairlearn (3)
AutoML\TunerFactory.cs (3)
28_moment = provider.GetService<ClassificationMoment>(); 29_context = provider.GetService<MLContext>(); 30_gridLimit = provider.GetService<GridLimit>().Value;
NativeIISSample (1)
Startup.cs (1)
99var server = context.RequestServices.GetService<IServer>();
TestProject.ServiceA (1)
Program.cs (1)
13app.MapGet("/urls", (IServiceProvider sp) => sp.GetService<IServer>()?.Features?.Get<IServerAddressesFeature>()?.Addresses);