2154 references to GetRequiredService
Aspire.Azure.AI.OpenAI (3)
AspireAzureOpenAIExtensions.cs (1)
46builder.Services.TryAddSingleton(typeof(OpenAIClient), static provider => provider.GetRequiredService<AzureOpenAIClient>());
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.AI.OpenAI.Tests (13)
AspireAzureAIOpenAIExtensionsTests.cs (6)
46host.Services.GetRequiredService<AzureOpenAIClient>(); 50host.Services.GetRequiredService<OpenAIClient>(); 77host.Services.GetRequiredService<AzureOpenAIClient>(); 103host.Services.GetRequiredService<AzureOpenAIClient>(); 123var client = host.Services.GetRequiredService<AzureOpenAIClient>(); 191var options = host.Services.GetRequiredService<IOptionsMonitor<AzureOpenAIClientOptions>>().Get(useKeyed ? "openai" : "Default");
AspireConfigurableOpenAIExtensionsTests.cs (7)
60host.Services.GetRequiredService<OpenAIClient>(); 87host.Services.GetRequiredService<OpenAIClient>(); 114host.Services.GetRequiredService<OpenAIClient>(); 133var openAiClient = host.Services.GetRequiredService<OpenAIClient>(); 160host.Services.GetRequiredService<OpenAIClient>(); 187host.Services.GetRequiredService<OpenAIClient>(); 214host.Services.GetRequiredService<OpenAIClient>();
Aspire.Azure.Data.Tables (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Data.Tables.Tests (4)
AspireTablesExtensionsTests.cs (4)
38host.Services.GetRequiredService<TableServiceClient>(); 65host.Services.GetRequiredService<TableServiceClient>(); 95host.Services.GetRequiredService<TableServiceClient>(); 123host.Services.GetRequiredService<TableServiceClient>();
Aspire.Azure.Messaging.EventHubs (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Messaging.ServiceBus (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Messaging.ServiceBus.Tests (5)
AspireServiceBusExtensionsTests.cs (5)
38host.Services.GetRequiredService<ServiceBusClient>(); 65host.Services.GetRequiredService<ServiceBusClient>(); 95host.Services.GetRequiredService<ServiceBusClient>(); 123host.Services.GetRequiredService<ServiceBusClient>(); 173var client = host.Services.GetRequiredService<ServiceBusClient>();
Aspire.Azure.Messaging.WebPubSub (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Messaging.WebPubSub.Tests (5)
AspireWebPubSubExtensionsTests.cs (5)
39host.Services.GetRequiredService<WebPubSubServiceClient>(); 74host.Services.GetRequiredService<WebPubSubServiceClient>(); 105host.Services.GetRequiredService<WebPubSubServiceClient>(); 134host.Services.GetRequiredService<WebPubSubServiceClient>(); 151var ex = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<WebPubSubServiceClient>);
Aspire.Azure.Search.Documents (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Search.Documents.Tests (2)
AspireAzureSearchExtensionsTests.cs (2)
39host.Services.GetRequiredService<SearchIndexClient>(); 66host.Services.GetRequiredService<SearchIndexClient>();
Aspire.Azure.Security.KeyVault (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Security.KeyVault.Tests (2)
AspireKeyVaultExtensionsTests.cs (2)
41host.Services.GetRequiredService<SecretClient>(); 71host.Services.GetRequiredService<SecretClient>();
Aspire.Azure.Storage.Blobs (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Storage.Blobs.Tests (4)
AspireBlobStorageExtensionsTests.cs (4)
38host.Services.GetRequiredService<BlobServiceClient>(); 65host.Services.GetRequiredService<BlobServiceClient>(); 95host.Services.GetRequiredService<BlobServiceClient>(); 123host.Services.GetRequiredService<BlobServiceClient>();
Aspire.Azure.Storage.Queues (2)
src\Components\Common\AzureComponent.cs (2)
110static (serviceProvider, serviceKey) => serviceProvider.GetRequiredService<IAzureClientFactory<TClient>>().CreateClient((string)serviceKey!)); 126? serviceProvider.GetRequiredService<TClient>()
Aspire.Azure.Storage.Queues.Tests (4)
AspireQueueStorageExtensionsTests.cs (4)
38host.Services.GetRequiredService<QueueServiceClient>(); 65host.Services.GetRequiredService<QueueServiceClient>(); 95host.Services.GetRequiredService<QueueServiceClient>(); 123host.Services.GetRequiredService<QueueServiceClient>();
Aspire.Components.Common.Tests (7)
ConformanceTests.cs (7)
123HealthCheckService healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 249Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TService>); 280? host.Services.GetRequiredService<TService>() 282TestLoggerFactory loggerFactory = (TestLoggerFactory)host.Services.GetRequiredService<ILoggerFactory>(); 311HealthCheckService healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 369? host.Services.GetRequiredService<TService>() 439? host.Services.GetRequiredService<TService>()
Aspire.Confluent.Kafka (8)
AspireKafkaConsumerExtensions.cs (4)
117builder.Services.AddSingleton<IConsumer<TKey, TValue>>(sp => sp.GetRequiredService<ConsumerConnectionFactory<TKey, TValue>>().Create()); 143? sp.GetRequiredService<ConsumerConnectionFactory<TKey, TValue>>() 169ILogger logger = serviceProvider.GetRequiredService<ILoggerFactory>().CreateLogger(ConfluentKafkaCommon.LogCategoryName); 186MetricsChannel channel = serviceProvider.GetRequiredService<MetricsChannel>();
AspireKafkaProducerExtensions.cs (4)
117builder.Services.AddSingleton<IProducer<TKey, TValue>>(sp => sp.GetRequiredService<ProducerConnectionFactory<TKey, TValue>>().Create()); 143? sp.GetRequiredService<ProducerConnectionFactory<TKey, TValue>>() 169ILogger logger = serviceProvider.GetRequiredService<ILoggerFactory>().CreateLogger(ConfluentKafkaCommon.LogCategoryName); 186MetricsChannel channel = serviceProvider.GetRequiredService<MetricsChannel>();
Aspire.Confluent.Kafka.Tests (6)
ConsumerConfigurationTests.cs (1)
209var __ = provider.GetRequiredService<IConfiguration>();
ConsumerConformanceTests.cs (1)
109var client1 = host.Services.GetRequiredService<IConsumer<string, string>>();
MetricsTests.cs (2)
46IMeterFactory meterFactory = host.Services.GetRequiredService<IMeterFactory>(); 163IMeterFactory meterFactory = host.Services.GetRequiredService<IMeterFactory>();
ProducerConfigurationTests.cs (1)
199var __ = provider.GetRequiredService<IConfiguration>();
ProducerConformanceTests.cs (1)
100var client1 = host.Services.GetRequiredService<IProducer<string, string>>();
Aspire.Dashboard (9)
DashboardWebApplication.cs (8)
170_dashboardOptionsMonitor = _app.Services.GetRequiredService<IOptionsMonitor<DashboardOptions>>(); 276_dashboardOptionsMonitor = _app.Services.GetRequiredService<IOptionsMonitor<DashboardOptions>>(); 296var corsOptions = _app.Services.GetRequiredService<IOptions<CorsOptions>>().Value; 332var options = _app.Services.GetRequiredService<IOptionsMonitor<DashboardOptions>>().CurrentValue; 349var client = context.RequestServices.GetRequiredService<IDashboardClientStatus>(); 456return _app.Services.GetRequiredService<ILoggerFactory>().CreateLogger<DashboardWebApplication>(); 569var logger = serverOptions.ApplicationServices.GetRequiredService<ILogger<DashboardWebApplication>>(); 688var options = context.HttpContext.RequestServices.GetRequiredService<IOptions<DashboardOptions>>().Value;
Model\ValidateTokenMiddleware.cs (1)
39var dashboardOptions = context.RequestServices.GetRequiredService<IOptionsMonitor<DashboardOptions>>();
Aspire.Dashboard.Components.Tests (23)
Controls\TextVisualizerDialogTests.cs (2)
163var menuService = Services.GetRequiredService<IMenuService>(); 166dialogService = Services.GetRequiredService<IDialogService>();
Pages\ConsoleLogsTests.cs (6)
50var dimensionManager = Services.GetRequiredService<DimensionManager>(); 62var logger = Services.GetRequiredService<ILogger<ConsoleLogsTests>>(); 63var loc = Services.GetRequiredService<IStringLocalizer<Resources.ConsoleLogs>>(); 110var dimensionManager = Services.GetRequiredService<DimensionManager>(); 122var logger = Services.GetRequiredService<ILogger<ConsoleLogsTests>>(); 123var loc = Services.GetRequiredService<IStringLocalizer<Resources.ConsoleLogs>>();
Pages\MetricsTests.cs (4)
76var navigationManager = Services.GetRequiredService<NavigationManager>(); 85var telemetryRepository = Services.GetRequiredService<TelemetryRepository>(); 127var navigationManager = Services.GetRequiredService<NavigationManager>(); 130var telemetryRepository = Services.GetRequiredService<TelemetryRepository>();
Pages\StructuredLogsTests.cs (9)
34var navigationManager = Services.GetRequiredService<NavigationManager>(); 40var dimensionManager = Services.GetRequiredService<DimensionManager>(); 50var viewModel = Services.GetRequiredService<StructuredLogsViewModel>(); 74var navigationManager = Services.GetRequiredService<NavigationManager>(); 80var dimensionManager = Services.GetRequiredService<DimensionManager>(); 90var viewModel = Services.GetRequiredService<StructuredLogsViewModel>(); 112var navigationManager = Services.GetRequiredService<NavigationManager>(); 118var dimensionManager = Services.GetRequiredService<DimensionManager>(); 128var viewModel = Services.GetRequiredService<StructuredLogsViewModel>();
Pages\TraceDetailsTests.cs (2)
39var dimensionManager = Services.GetRequiredService<DimensionManager>(); 42var telemetryRepository = Services.GetRequiredService<TelemetryRepository>();
Aspire.Dashboard.Tests (2)
Integration\StartupTests.cs (2)
497var options = app.Services.GetRequiredService<IOptions<LoggerFilterOptions>>(); 536var options = app.Services.GetRequiredService<IOptions<LoggerFilterOptions>>();
Aspire.Elastic.Clients.Elasticsearch (1)
AspireElasticClientsElasticsearchExtensions.cs (1)
112sp.GetRequiredService<ElasticsearchClient>() :
Aspire.Elastic.Clients.Elasticsearch.Tests (4)
AspireElasticClientExtensionsTest.cs (4)
57var healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 111var client1 = host.Services.GetRequiredService<ElasticsearchClient>(); 135var client1 = host.Services.GetRequiredService<ElasticsearchClient>(); 157var elasticsearchClient = host.Services.GetRequiredService<ElasticsearchClient>();
Aspire.EndToEnd.Tests (1)
tests\Shared\WorkloadTesting\AspireProject.cs (1)
493return services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>().CreateClient();
Aspire.Hosting (10)
DistributedApplication.cs (3)
349var beforeStartEvent = new BeforeStartEvent(_host.Services, _host.Services.GetRequiredService<DistributedApplicationModel>()); 350var eventing = _host.Services.GetRequiredService<IDistributedApplicationEventing>(); 354var appModel = _host.Services.GetRequiredService<DistributedApplicationModel>();
DistributedApplicationBuilder.cs (6)
272_innerBuilder.Services.AddHostedService(sp => sp.GetRequiredService<DashboardServiceHost>()); 319var appModel = sp.GetRequiredService<DistributedApplicationModel>(); 320var logger = sp.GetRequiredService<ILogger<DistributedApplicationBuilder>>(); 336sp.GetRequiredService<ILogger<DistributedApplicationBuilder>>().LogCritical( 361_innerBuilder.Services.AddHostedService<ResourceHealthCheckService>(sp => sp.GetRequiredService<ResourceHealthCheckService>()); 412_executionContextOptions.ServiceProvider = application.Services.GetRequiredService<IServiceProvider>();
ParameterResourceBuilderExtensions.cs (1)
187sp.GetRequiredService<ResourceLoggerService>(),
Aspire.Hosting.Azure.Tests (32)
AzureContainerAppsTests.cs (20)
33var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 129var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 233var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 378var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 518var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 773var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 871var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 983var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1134var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1292var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1381var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1479var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1584var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1680var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1816var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1837var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1856var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1876var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1895var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 1914var model = app.Services.GetRequiredService<DistributedApplicationModel>();
AzureCosmosDBEmulatorFunctionalTests.cs (5)
46var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 103using var cosmosClient = host.Services.GetRequiredService<CosmosClient>(); 104using var dbContext = host.Services.GetRequiredService<EFCoreCosmosDbContext>(); 179using var cosmosClient = host.Services.GetRequiredService<CosmosClient>(); 225using var cosmosClient = host.Services.GetRequiredService<CosmosClient>();
AzureEventHubsExtensionsTests.cs (3)
47var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 85var producerClient = host.Services.GetRequiredService<EventHubProducerClient>(); 86var consumerClient = host.Services.GetRequiredService<EventHubConsumerClient>();
AzureFunctionsTests.cs (2)
124var model = host.Services.GetRequiredService<DistributedApplicationModel>(); 145var model = host.Services.GetRequiredService<DistributedApplicationModel>();
AzureStorageEmulatorFunctionalTests.cs (2)
48var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 84var serviceClient = host.Services.GetRequiredService<BlobServiceClient>();
Aspire.Hosting.Containers.Tests (9)
ContainerResourceTests.cs (4)
22var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 41var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 173var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources()); 241var containerResource = Assert.Single(app.Services.GetRequiredService<DistributedApplicationModel>().GetContainerResources());
WithDockerfileTests.cs (5)
111var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 143var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 371var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 441var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 756var rns = app.Services.GetRequiredService<ResourceNotificationService>();
Aspire.Hosting.Dapr.Tests (2)
DaprTests.cs (2)
38var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 137var model = app.Services.GetRequiredService<DistributedApplicationModel>();
Aspire.Hosting.Elasticsearch.Tests (7)
AddElasticsearchTests.cs (3)
24var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 86var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 147var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
ElasticsearchFunctionalTests.cs (4)
59var elasticsearchClient = host.Services.GetRequiredService<ElasticsearchClient>(); 121var elasticsearchClient = host.Services.GetRequiredService<ElasticsearchClient>(); 165var elasticsearchClient = host.Services.GetRequiredService<ElasticsearchClient>(); 229var rns = app.Services.GetRequiredService<ResourceNotificationService>();
Aspire.Hosting.Garnet.Tests (7)
AddGarnetTests.cs (3)
22var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 50var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 79var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
GarnetFunctionalTests.cs (4)
42var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 86var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 167var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 218var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>();
Aspire.Hosting.Kafka.Tests (7)
AddKafkaTests.cs (2)
23var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 65var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
KafkaFunctionalTests.cs (5)
43var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 96var producer = host.Services.GetRequiredService<IProducer<string, string>>(); 103var consumer = host.Services.GetRequiredService<IConsumer<string, string>>(); 182var producer = host.Services.GetRequiredService<IProducer<string, string>>(); 238var consumer = host.Services.GetRequiredService<IConsumer<string, string>>();
Aspire.Hosting.Keycloak.Tests (1)
KeycloakResourceBuilderTests.cs (1)
24var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
Aspire.Hosting.Milvus.Tests (6)
AddMilvusTests.cs (3)
27var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 58var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 191var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
MilvusFunctionalTests.cs (3)
44var milvusClient = host.Services.GetRequiredService<MilvusClient>(); 118var milvusClient = host.Services.GetRequiredService<MilvusClient>(); 166var milvusClient = host.Services.GetRequiredService<MilvusClient>();
Aspire.Hosting.MongoDB.Tests (9)
AddMongoDBTests.cs (3)
24var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 52var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 83var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
MongoDbFunctionalTests.cs (6)
54var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 99var mongoDatabase = host.Services.GetRequiredService<IMongoDatabase>(); 159var mongoDatabase = host.Services.GetRequiredService<IMongoDatabase>(); 206var mongoDatabase = host.Services.GetRequiredService<IMongoDatabase>(); 325var mongoDatabase = host.Services.GetRequiredService<IMongoDatabase>(); 329var mongoDatabase = host.Services.GetRequiredService<IMongoDatabase>();
Aspire.Hosting.MySql.Tests (19)
AddMySqlTests.cs (7)
44var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 84var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 122var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 141var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 243await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>())); 282var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 284builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
MySqlFunctionalTests.cs (12)
50var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 103using var connection = host.Services.GetRequiredService<MySqlConnection>(); 178using var connection = host.Services.GetRequiredService<MySqlConnection>(); 185using var connection = host.Services.GetRequiredService<MySqlConnection>(); 248using var connection = host.Services.GetRequiredService<MySqlConnection>(); 255using var connection = host.Services.GetRequiredService<MySqlConnection>(); 354using var connection = host.Services.GetRequiredService<MySqlConnection>(); 361using var connection = host.Services.GetRequiredService<MySqlConnection>(); 424var dbContext = host.Services.GetRequiredService<TestDbContext>(); 432var dbContext = host.Services.GetRequiredService<TestDbContext>(); 439var dbContext = host.Services.GetRequiredService<TestDbContext>(); 446var dbContext = host.Services.GetRequiredService<TestDbContext>();
Aspire.Hosting.Nats (1)
NatsBuilderExtensions.cs (1)
65LoggerFactory = @event.Services.GetRequiredService<ILoggerFactory>(),
Aspire.Hosting.Nats.Tests (10)
AddNatsTests.cs (4)
47var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 76var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 94var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 136var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
NatsFunctionalTests.cs (6)
55var jetStream = host.Services.GetRequiredService<INatsJSContext>(); 99var natsConnection = host.Services.GetRequiredService<INatsConnection>(); 147var natsConnection = host.Services.GetRequiredService<INatsConnection>(); 206var jetStream = host.Services.GetRequiredService<INatsJSContext>(); 253var jetStream = host.Services.GetRequiredService<INatsJSContext>(); 345var rns = app.Services.GetRequiredService<ResourceNotificationService>();
Aspire.Hosting.Oracle.Tests (10)
AddOracleTests.cs (5)
43var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 83var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 121var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 141var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 165var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
OracleFunctionalTests.cs (5)
60var dbContext = host.Services.GetRequiredService<TestDbContext>(); 143using var dbContext = host.Services.GetRequiredService<TestDbContext>(); 204using var dbContext = host.Services.GetRequiredService<TestDbContext>(); 320var dbContext = host.Services.GetRequiredService<TestDbContext>(); 373var rns = app.Services.GetRequiredService<ResourceNotificationService>();
Aspire.Hosting.PostgreSQL (1)
PostgresBuilderExtensions.cs (1)
344var config = context.ExecutionContext.ServiceProvider.GetRequiredService<IConfiguration>();
Aspire.Hosting.PostgreSQL.Tests (13)
AddPostgresTests.cs (7)
53var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 108var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 176var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 199var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 468await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>())); 514var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 516await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
PostgresFunctionalTests.cs (6)
53var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 134using var connection = host.Services.GetRequiredService<NpgsqlConnection>(); 250using var connection = host.Services.GetRequiredService<NpgsqlConnection>(); 311using var connection = host.Services.GetRequiredService<NpgsqlConnection>(); 404using var connection = host.Services.GetRequiredService<NpgsqlConnection>(); 411using var connection = host.Services.GetRequiredService<NpgsqlConnection>();
Aspire.Hosting.Python.Tests (4)
AddPythonAppTests.cs (4)
97var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 140var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 176var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 215var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
Aspire.Hosting.Qdrant.Tests (8)
AddQdrantTests.cs (4)
46var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 85var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 119var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 287var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
QdrantFunctionalTests.cs (4)
57var qdrantClient = host.Services.GetRequiredService<QdrantClient>(); 141var qdrantClient = host.Services.GetRequiredService<QdrantClient>(); 186var qdrantClient = host.Services.GetRequiredService<QdrantClient>(); 245var rns = app.Services.GetRequiredService<ResourceNotificationService>();
Aspire.Hosting.RabbitMQ.Tests (7)
AddRabbitMQTests.cs (3)
51var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 104var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 138var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
RabbitMQFunctionalTests.cs (4)
44var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 81var connection = host.Services.GetRequiredService<IConnection>(); 143var connection = host.Services.GetRequiredService<IConnection>(); 200var connection = host.Services.GetRequiredService<IConnection>();
Aspire.Hosting.Redis (1)
RedisBuilderExtensions.cs (1)
193var rls = e.Services.GetRequiredService<ResourceLoggerService>();
Aspire.Hosting.Redis.Tests (15)
AddRedisTests.cs (5)
31var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 59var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 88var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 216await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>())); 240await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new (app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
RedisFunctionalTests.cs (10)
48var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 114var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 222var rns = app2.Services.GetRequiredService<ResourceNotificationService>(); 224var executorProxy = app2.Services.GetRequiredService<ApplicationExecutorProxy>(); 325var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 361var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 411var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 446var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 495var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 525var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>();
Aspire.Hosting.SqlServer.Tests (10)
AddSqlServerTests.cs (3)
44var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 92var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 115var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
SqlServerFunctionalTests.cs (7)
44var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 93var conn = host.Services.GetRequiredService<SqlConnection>(); 107var dbContext = host.Services.GetRequiredService<TestDbContext>(); 196var conn = host1.Services.GetRequiredService<SqlConnection>(); 220var conn = host1.Services.GetRequiredService<SqlConnection>(); 278var conn = host2.Services.GetRequiredService<SqlConnection>(); 286var conn = host2.Services.GetRequiredService<SqlConnection>();
Aspire.Hosting.Testing (3)
DistributedApplicationHostingTestingExtensions.cs (3)
26var clientFactory = app.Services.GetRequiredService<IHttpClientFactory>(); 66var applicationModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 107var lifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
Aspire.Hosting.Testing.Tests (9)
DistributedApplicationHttpClientExtensionsForTests.cs (1)
28return services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>();
TestingBuilderTests.cs (3)
140var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 190var hostEnvironment = app.Services.GetRequiredService<IHostEnvironment>(); 205var config = app.Services.GetRequiredService<IConfiguration>();
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (5)
35var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 68var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>(); 114var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>(); 115var resourceLoggerService = app.Services.GetRequiredService<ResourceLoggerService>(); 116var logger = app.Services.GetRequiredService<ILoggerFactory>().CreateLogger(nameof(LoggerNotificationExtensions));
Aspire.Hosting.Tests (127)
AddParameterTests.cs (7)
26var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 63var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 110var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 144var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 194var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 251var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 308var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
Codespaces\CodespacesUrlRewriterTests.cs (2)
33var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 70var rns = app.Services.GetRequiredService<ResourceNotificationService>();
Dashboard\DashboardResourceTests.cs (15)
46var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 70var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 101var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 171var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 207var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 242var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 274var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 310var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 353var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 378var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 394var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 445var resourceLoggerService = app.Services.GetRequiredService<ResourceLoggerService>(); 459var model = app.Services.GetRequiredService<DistributedApplicationModel>(); 460var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>(); 511var model = app.Services.GetRequiredService<DistributedApplicationModel>();
Dcp\ApplicationExecutorTests.cs (25)
36var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 61var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 113var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 145var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 177var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 210var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 247var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 267var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 301var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 335var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 399var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 421var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 457var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 555var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 661var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 706var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 743var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 778var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 838var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 859var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 895var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 932var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 962var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 982var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 1001var distributedAppModel = app.Services.GetRequiredService<DistributedApplicationModel>();
DistributedApplicationBuilderTests.cs (6)
41var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 47var options = app.Services.GetRequiredService<IOptions<PublishingOptions>>(); 59var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 95var config = app.Services.GetRequiredService<IConfiguration>(); 105var config = app.Services.GetRequiredService<IConfiguration>(); 116var config = app.Services.GetRequiredService<IConfiguration>();
DistributedApplicationTests.cs (29)
192var logger = app.Services.GetRequiredService<ILogger<DistributedApplicationTests>>(); 251var s = app.Services.GetRequiredService<IKubernetesService>(); 279var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 280var applicationExecutor = app.Services.GetRequiredService<ApplicationExecutor>(); 281var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 316var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 317var applicationExecutor = app.Services.GetRequiredService<ApplicationExecutor>(); 318var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 359var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 363var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 412var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 416var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 451var kubernetes = app.Services.GetRequiredService<IKubernetesService>(); 455var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 486var s = app.Services.GetRequiredService<IKubernetesService>(); 488var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 515var s = app.Services.GetRequiredService<IKubernetesService>(); 517var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 544var s = app.Services.GetRequiredService<IKubernetesService>(); 546var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 574var s = app.Services.GetRequiredService<IKubernetesService>(); 576var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 600var s = app.Services.GetRequiredService<IKubernetesService>(); 660var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 679var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 815var s = app.Services.GetRequiredService<IKubernetesService>(); 818var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 852var suffix = app.Services.GetRequiredService<IOptions<DcpOptions>>().Value.ResourceNameSuffix; 868var s = app.Services.GetRequiredService<IKubernetesService>();
Eventing\DistributedApplicationBuilderEventingTests.cs (1)
169var eventing = app.Services.GetRequiredService<IDistributedApplicationEventing>();
Health\ResourceHealthCheckServiceTests.cs (9)
25var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 59var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 102var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 149var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 189var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 220var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 270var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 330var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 383var rns = app.Services.GetRequiredService<ResourceNotificationService>();
HealthCheckTests.cs (1)
86var rns = app.Services.GetRequiredService<ResourceNotificationService>();
KestrelConfigTests.cs (1)
360var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
ProjectResourceTests.cs (15)
69var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 183var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 210var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 228var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 244var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 292var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 312var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 355var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 377var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 402var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 432var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 451var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 475var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 525var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 617var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
tests\Aspire.Hosting.Testing.Tests\DistributedApplicationHttpClientExtensionsForTests.cs (1)
28return services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>();
Utils\LoggerNotificationExtensions.cs (5)
35var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 68var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>(); 114var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>(); 115var resourceLoggerService = app.Services.GetRequiredService<ResourceLoggerService>(); 116var logger = app.Services.GetRequiredService<ILoggerFactory>().CreateLogger(nameof(LoggerNotificationExtensions));
Utils\TestDistributedApplicationBuilder.cs (1)
81_innerBuilder.Services.AddSingleton<ApplicationExecutorProxy>(sp => new ApplicationExecutorProxy(sp.GetRequiredService<ApplicationExecutor>()));
WaitForTests.cs (7)
31var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 107var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 148var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 196var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 244var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 293var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 327var rns = app.Services.GetRequiredService<ResourceNotificationService>();
WithEndpointTests.cs (1)
210var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
WithEnvironmentTests.cs (1)
28var serviceProvider = app.Services.GetRequiredService<IServiceProvider>();
Aspire.Hosting.Valkey.Tests (7)
AddValkeyTests.cs (3)
22var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 50var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 79var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
ValkeyFunctionalTests.cs (4)
47var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 108var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 159var redisClient = host.Services.GetRequiredService<IConnectionMultiplexer>(); 219var rns = app.Services.GetRequiredService<ResourceNotificationService>();
Aspire.Keycloak.Authentication.Tests (8)
AspireKeycloakExtensionTests.cs (8)
30host.Services.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>() 50host.Services.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>().Get(scheme)); 70var options = host.Services.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>() 92var options = host.Services.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>() 111host.Services.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>() 131host.Services.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>().Get(scheme)); 152var options = host.Services.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>() 175var options = host.Services.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>()
Aspire.Microsoft.Azure.Cosmos.Tests (1)
ConformanceTests.cs (1)
92var client1 = host.Services.GetRequiredService<CosmosClient>();
Aspire.Microsoft.Data.SqlClient (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\TracerProviderBuilderExtensions.cs (1)
73var sqlOptions = sp.GetRequiredService<IOptionsMonitor<SqlClientTraceInstrumentationOptions>>().Get(name);
Aspire.Microsoft.Data.SqlClient.Tests (4)
AspireSqlServerSqlClientExtensionsTests.cs (4)
38host.Services.GetRequiredService<SqlConnection>(); 66host.Services.GetRequiredService<SqlConnection>(); 98host.Services.GetRequiredService<SqlConnection>(); 121var connection1 = host.Services.GetRequiredService<SqlConnection>();
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (9)
AspireAzureEfCoreCosmosDBExtensionsTests.cs (5)
36var context = host.Services.GetRequiredService<TestDbContext>(); 73var context = host.Services.GetRequiredService<TestDbContext>(); 113var context = host.Services.GetRequiredService<TestDbContext>(); 144var context = host.Services.GetRequiredService<TestDbContext>(); 145var context2 = host.Services.GetRequiredService<TestDbContext2>();
EnrichCosmosDbTests.cs (4)
68var context = host.Services.GetRequiredService<TestDbContext>(); 97var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 118var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 135var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>);
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\TracerProviderBuilderExtensions.cs (1)
73var sqlOptions = sp.GetRequiredService<IOptionsMonitor<SqlClientTraceInstrumentationOptions>>().Get(name);
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (19)
AspireSqlServerEFCoreSqlClientExtensionsTests.cs (9)
31var context = host.Services.GetRequiredService<TestDbContext>(); 47var context = host.Services.GetRequiredService<TestDbContext>(); 67var context = host.Services.GetRequiredService<TestDbContext>(); 94var context = host.Services.GetRequiredService<TestDbContext>(); 138var context = host.Services.GetRequiredService<TestDbContext>(); 179var context = host.Services.GetRequiredService<TestDbContext>(); 214var context = host.Services.GetRequiredService<TestDbContext>(); 245var context = host.Services.GetRequiredService<TestDbContext>(); 246var context2 = host.Services.GetRequiredService<TestDbContext2>();
EnrichSqlServerTests.cs (10)
74var context = host.Services.GetRequiredService<TestDbContext>(); 109var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 129var context = host.Services.GetRequiredService<TestDbContext>(); 172var context = host.Services.GetRequiredService<TestDbContext>(); 210var context = host.Services.GetRequiredService<TestDbContext>(); 238var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 259var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 276var context = host.Services.GetRequiredService<TestDbContext>(); 304var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 321var context = host.Services.GetRequiredService<TestDbContext>();
Aspire.Milvus.Client (2)
AspireMilvusExtensions.cs (2)
95? sp.GetRequiredService<MilvusClient>() 106return new MilvusClient(settings.Endpoint, apiKey: settings.Key, database: settings.Database, loggerFactory: serviceProvider.GetRequiredService<ILoggerFactory>());
Aspire.Milvus.Client.Tests (5)
AspireMilvusExtensionTests.cs (4)
51host.Services.GetRequiredService<MilvusClient>(); 75host.Services.GetRequiredService<MilvusClient>(); 105host.Services.GetRequiredService<MilvusClient>(); 135var healthCheckService = host.Services.GetRequiredService<HealthCheckService>();
ConformanceTests.cs (1)
120var client1 = host.Services.GetRequiredService<MilvusClient>();
Aspire.MongoDB.Driver (1)
AspireMongoDBDriverExtensions.cs (1)
144.GetRequiredService<IMongoClient>()
Aspire.MongoDB.Driver.Tests (4)
AspireMongoDBDriverExtensionsTests.cs (4)
40var mongoClient = host.Services.GetRequiredService<IMongoClient>(); 132var healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 176var healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 219var connection1 = host.Services.GetRequiredService<IMongoDatabase>();
Aspire.MySqlConnector (1)
AspireMySqlConnectorExtensions.cs (1)
81? sp.GetRequiredService<MySqlDataSource>()
Aspire.MySqlConnector.Tests (4)
AspireMySqlConnectorExtensionsTests.cs (4)
46host.Services.GetRequiredService<MySqlDataSource>(); 74host.Services.GetRequiredService<MySqlDataSource>(); 106host.Services.GetRequiredService<MySqlDataSource>(); 129var connection1 = host.Services.GetRequiredService<MySqlDataSource>();
Aspire.NATS.Net (4)
AspireNatsClientExtensions.cs (4)
82LoggerFactory = provider.GetRequiredService<ILoggerFactory>(), 103builder.Services.TryAddSingleton<INatsConnection>(static provider => provider.GetRequiredService<NatsConnection>()); 116? sp.GetRequiredService<INatsConnection>() 145return new NatsJSContextFactory().CreateContext(provider.GetRequiredService<INatsConnection>());
Aspire.NATS.Net.Tests (7)
AspireNatsClientExtensionsTests.cs (7)
53host.Services.GetRequiredService<INatsConnection>(); 80host.Services.GetRequiredService<INatsConnection>(); 111host.Services.GetRequiredService<INatsConnection>(); 143host.Services.GetRequiredService<INatsConnection>(); 169var healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 223var nats = host.Services.GetRequiredService<INatsConnection>(); 251var connection1 = host.Services.GetRequiredService<INatsConnection>();
Aspire.Npgsql (1)
AspirePostgreSqlNpgsqlExtensions.cs (1)
82? sp.GetRequiredService<NpgsqlDataSource>()
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (19)
AspireEFPostgreSqlExtensionsTests.cs (9)
39var context = host.Services.GetRequiredService<TestDbContext>(); 57var context = host.Services.GetRequiredService<TestDbContext>(); 77var context = host.Services.GetRequiredService<TestDbContext>(); 104var context = host.Services.GetRequiredService<TestDbContext>(); 146var context = host.Services.GetRequiredService<TestDbContext>(); 187var context = host.Services.GetRequiredService<TestDbContext>(); 221var context = host.Services.GetRequiredService<TestDbContext>(); 252var context = host.Services.GetRequiredService<TestDbContext>(); 253var context2 = host.Services.GetRequiredService<TestDbContext2>();
EnrichNpgsqlTests.cs (10)
76var context = host.Services.GetRequiredService<TestDbContext>(); 112var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 133var context = host.Services.GetRequiredService<TestDbContext>(); 177var context = host.Services.GetRequiredService<TestDbContext>(); 216var context = host.Services.GetRequiredService<TestDbContext>(); 246var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 268var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 286var context = host.Services.GetRequiredService<TestDbContext>(); 315var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 333var context = host.Services.GetRequiredService<TestDbContext>();
Aspire.Npgsql.Tests (5)
AspirePostgreSqlNpgsqlExtensionsTests.cs (5)
38host.Services.GetRequiredService<NpgsqlDataSource>(); 66host.Services.GetRequiredService<NpgsqlDataSource>(); 98host.Services.GetRequiredService<NpgsqlDataSource>(); 130host.Services.GetRequiredService<NpgsqlDataSource>(); 151var connection1 = host.Services.GetRequiredService<NpgsqlDataSource>();
Aspire.OpenAI (1)
AspireOpenAIExtensions.cs (1)
127var options = serviceProvider.GetRequiredService<IOptions<OpenAIClientOptions>>().Value;
Aspire.OpenAI.Tests (7)
AspireOpenAIExtensionsTests.cs (7)
39host.Services.GetRequiredService<OpenAIClient>(); 66host.Services.GetRequiredService<OpenAIClient>(); 84var client = host.Services.GetRequiredService<OpenAIClient>(); 103var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<OpenAIClient>); 127var client1 = host.Services.GetRequiredService<OpenAIClient>(); 174var options = host.Services.GetRequiredService<IOptions<OpenAIClientOptions>>().Value; 194var options = host.Services.GetRequiredService<IOptions<OpenAIClientOptions>>().Value;
Aspire.Oracle.EntityFrameworkCore.Tests (22)
AspireOracleEFCoreDatabaseExtensionsTests.cs (11)
32var context = host.Services.GetRequiredService<TestDbContext>(); 48var context = host.Services.GetRequiredService<TestDbContext>(); 68var context = host.Services.GetRequiredService<TestDbContext>(); 95var context = host.Services.GetRequiredService<TestDbContext>(); 139var context = host.Services.GetRequiredService<TestDbContext>(); 180var context = host.Services.GetRequiredService<TestDbContext>(); 215var context = host.Services.GetRequiredService<TestDbContext>(); 246var context = host.Services.GetRequiredService<TestDbContext>(); 247var context2 = host.Services.GetRequiredService<TestDbContext2>(); 314var context = host.Services.GetRequiredService<TestDbContext>(); 330var context = host.Services.GetRequiredService<TestDbContext>();
ConformanceTests.cs (1)
164var service = host.Services.GetRequiredService<TestDbContext>();
EnrichOracleDatabaseTests.cs (10)
75var context = host.Services.GetRequiredService<TestDbContext>(); 110var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 130var context = host.Services.GetRequiredService<TestDbContext>(); 173var context = host.Services.GetRequiredService<TestDbContext>(); 211var context = host.Services.GetRequiredService<TestDbContext>(); 239var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 260var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 277var context = host.Services.GetRequiredService<TestDbContext>(); 305var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 322var context = host.Services.GetRequiredService<TestDbContext>();
Aspire.Playground.Tests (15)
AppHostTests.cs (2)
69var applicationModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 70var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>();
Infrastructure\DistributedApplicationExtensions.cs (8)
88var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>(); 102var applicationModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 103var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>(); 113var environment = app.Services.GetRequiredService<IHostEnvironment>(); 131var environment = app.Services.GetRequiredService<IHostEnvironment>(); 132var applicationModel = app.Services.GetRequiredService<DistributedApplicationModel>(); 200var httpClientFactory = services.GetRequiredService<IHttpClientFactory>(); 213var logger = app.Services.GetRequiredService<ILoggerFactory>().CreateLogger(nameof(TryApplyEfMigrationsAsync));
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (5)
35var rns = app.Services.GetRequiredService<ResourceNotificationService>(); 68var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>(); 114var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>(); 115var resourceLoggerService = app.Services.GetRequiredService<ResourceLoggerService>(); 116var logger = app.Services.GetRequiredService<ILoggerFactory>().CreateLogger(nameof(LoggerNotificationExtensions));
Aspire.Pomelo.EntityFrameworkCore.MySql (1)
AspireEFMySqlExtensions.cs (1)
106var resiliencePipelineProvider = serviceProvider.GetRequiredService<ResiliencePipelineProvider<string>>();
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (17)
AspireEFMySqlExtensionsTests.cs (7)
44var context = host.Services.GetRequiredService<TestDbContext>(); 63var context = host.Services.GetRequiredService<TestDbContext>(); 85var context = host.Services.GetRequiredService<TestDbContext>(); 113var context = host.Services.GetRequiredService<TestDbContext>(); 156var context = host.Services.GetRequiredService<TestDbContext>(); 199var context = host.Services.GetRequiredService<TestDbContext>(); 237var context = host.Services.GetRequiredService<TestDbContext>();
EnrichMySqlTests.cs (10)
88var context = host.Services.GetRequiredService<TestDbContext>(); 123var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 143var context = host.Services.GetRequiredService<TestDbContext>(); 186var context = host.Services.GetRequiredService<TestDbContext>(); 224var context = host.Services.GetRequiredService<TestDbContext>(); 252var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 273var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 290var context = host.Services.GetRequiredService<TestDbContext>(); 318var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 335var context = host.Services.GetRequiredService<TestDbContext>();
Aspire.Qdrant.Client (2)
AspireQdrantExtensions.cs (2)
92sp.GetRequiredService<QdrantClient>() : 104return new QdrantClient(settings.Endpoint, apiKey: settings.Key, loggerFactory: serviceProvider.GetRequiredService<ILoggerFactory>());
Aspire.Qdrant.Client.Tests (2)
AspireQdrantClientExtensionsTest.cs (2)
49var healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 103var client1 = host.Services.GetRequiredService<QdrantClient>();
Aspire.RabbitMQ.Client (3)
AspireRabbitMQExtensions.cs (3)
91sp.GetRequiredService<RabbitMQEventSourceLogForwarder>().Start(); 115builder.Services.AddSingleton<IConnection>(sp => CreateConnection(sp.GetRequiredService<IConnectionFactory>(), settings.MaxConnectRetryCount)); 143options.Connection = serviceKey is null ? sp.GetRequiredService<IConnection>() : sp.GetRequiredKeyedService<IConnection>(serviceKey);
Aspire.RabbitMQ.Client.Tests (8)
AspireRabbitMQExtensionsTests.cs (5)
48host.Services.GetRequiredService<IConnection>(); 77host.Services.GetRequiredService<IConnection>(); 108host.Services.GetRequiredService<IConnection>(); 149var connectionFactory = (ConnectionFactory)host.Services.GetRequiredService<IConnectionFactory>(); 182var connection1 = host.Services.GetRequiredService<IConnection>();
AspireRabbitMQLoggingTests.cs (3)
57using var connection = host.Services.GetRequiredService<IConnection>(); 81host.Services.GetRequiredService<RabbitMQEventSourceLogForwarder>().Start(); 110host.Services.GetRequiredService<RabbitMQEventSourceLogForwarder>().Start();
Aspire.StackExchange.Redis (7)
AspireRedisExtensions.cs (4)
123t.AddInstrumentation(sp => sp.GetRequiredService<StackExchangeRedisInstrumentation>()); 137connectionMultiplexerFactory: sp => serviceKey is null ? sp.GetRequiredService<IConnectionMultiplexer>() : sp.GetRequiredKeyedService<IConnectionMultiplexer>(serviceKey), 156serviceProvider.GetRequiredService<IOptions<ConfigurationOptions>>().Value : 157serviceProvider.GetRequiredService<IOptionsMonitor<ConfigurationOptions>>().Get(optionsName);
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\TracerProviderBuilderExtensions.cs (3)
120var instrumentation = sp.GetRequiredService<StackExchangeRedisInstrumentation>(); 168(sp, builder) => configure(sp, sp.GetRequiredService<StackExchangeRedisInstrumentation>())); 182sp.GetRequiredService<IOptionsMonitor<StackExchangeRedisInstrumentationOptions>>()));
Aspire.StackExchange.Redis.DistributedCaching (1)
AspireRedisDistributedCacheExtensions.cs (1)
36options.ConnectionMultiplexerFactory = () => Task.FromResult(sp.GetRequiredService<IConnectionMultiplexer>());
Aspire.StackExchange.Redis.DistributedCaching.Tests (1)
AspireRedisDistributedCacheExtensionsTests.cs (1)
22var cache = host.Services.GetRequiredService<IDistributedCache>();
Aspire.StackExchange.Redis.OutputCaching (1)
AspireRedisOutputCacheExtensions.cs (1)
35options.ConnectionMultiplexerFactory = () => Task.FromResult(sp.GetRequiredService<IConnectionMultiplexer>());
Aspire.StackExchange.Redis.OutputCaching.Tests (1)
AspireRedisOutputCacheExtensionsTests.cs (1)
21var cacheStore = host.Services.GetRequiredService<IOutputCacheStore>();
Aspire.StackExchange.Redis.Tests (14)
AspireRedisExtensionsTests.cs (14)
49var connection = host.Services.GetRequiredService<IConnectionMultiplexer>(); 77host.Services.GetRequiredService<IConnectionMultiplexer>(); 106host.Services.GetRequiredService<IConnectionMultiplexer>(); 139host.Services.GetRequiredService<IConnectionMultiplexer>(); 194host.Services.GetRequiredService<IOptionsMonitor<ConfigurationOptions>>().Get("redis") : 195host.Services.GetRequiredService<IOptions<ConfigurationOptions>>().Value; 226var distributedCache = host.Services.GetRequiredService<IDistributedCache>(); 229var cacheStore = host.Services.GetRequiredService<IOutputCacheStore>(); 234var healthCheckService = host.Services.GetRequiredService<HealthCheckService>(); 254var tracerProvider = host.Services.GetRequiredService<TracerProvider>(); 319var connection1 = host.Services.GetRequiredService<IConnectionMultiplexer>(); 356var connection1 = host.Services.GetRequiredService<IConnectionMultiplexer>(); 358var distributedCache = host.Services.GetRequiredService<IDistributedCache>(); 360var outputCache = host.Services.GetRequiredService<IOutputCacheStore>();
Aspire.Workload.Tests (1)
tests\Shared\WorkloadTesting\AspireProject.cs (1)
493return services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>().CreateClient();
BasicWebSite (3)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
57var urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
StartupWithoutEndpointRouting.cs (1)
60var contextAccessor = serviceProvider.GetRequiredService<IHttpContextAccessor>();
StoreIntoTempDataActionResult.cs (1)
15var tempDataDictionaryFactory = httpContext.RequestServices.GetRequiredService<ITempDataDictionaryFactory>();
blazor-devserver (1)
Server\Startup.cs (1)
33var webHostEnvironment = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>();
CatalogDb (2)
CatalogDbInitializer.cs (1)
16var dbContext = scope.ServiceProvider.GetRequiredService<CatalogDbContext>();
Program.cs (1)
12builder.Services.AddHostedService(sp => sp.GetRequiredService<CatalogDbInitializer>());
CreateDefaultBuilderApp (1)
Program.cs (1)
33var hostingEnvironment = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>();
CreateDefaultBuilderOfTApp (2)
Program.cs (2)
37var hostFilteringOptions = app.ApplicationServices.GetRequiredService<IOptions<HostFilteringOptions>>(); 44var hostingEnvironment = app.ApplicationServices.GetRequiredService<IHostEnvironment>();
CustomEncryptorSample (2)
CustomXmlDecryptor.cs (1)
17_logger = services.GetRequiredService<ILoggerFactory>().CreateLogger<CustomXmlDecryptor>();
CustomXmlEncryptor.cs (1)
17_logger = services.GetRequiredService<ILoggerFactory>().CreateLogger<CustomXmlEncryptor>();
DatabaseMigration.MigrationService (1)
ApiDbInitializer.cs (1)
27var dbContext = scope.ServiceProvider.GetRequiredService<MyDb1Context>();
GenericHostWebSite (1)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
57var urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
HealthChecksSample (2)
DbContextHealthStartup.cs (2)
53var myContext = context.RequestServices.GetRequiredService<MyContext>(); 65var myContext = context.RequestServices.GetRequiredService<MyContext>();
Http3SampleApp (1)
Program.cs (1)
120using var httpEventSource = new HttpEventSourceListener(host.Services.GetRequiredService<ILoggerFactory>());
InMemory.FunctionalTests (3)
Http2\Http2EndToEndTests.cs (1)
35var logger = context.RequestServices.GetRequiredService<ILogger<Http2EndToEndTests>>();
HttpsConnectionMiddlewareTests.cs (1)
82var loader = new KestrelConfigurationLoader(options, configuration, options.ApplicationServices.GetRequiredService<IHttpsConfigurationService>(), certificatePathWatcher: null, reloadOnChange: false);
TestTransport\TestServer.cs (1)
101sp.GetRequiredService<IHttpsConfigurationService>(),
InProcessWebSite (1)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (1)
65var appLifetime = app.ApplicationServices.GetRequiredService<Microsoft.AspNetCore.Hosting.IApplicationLifetime>();
IntegrationTestsWebsite (1)
Startup.cs (1)
35endpoints.DataSources.Add(endpoints.ServiceProvider.GetRequiredService<DynamicEndpointDataSource>());
Interop.FunctionalTests (6)
Http2\Http2RequestTests.cs (3)
40var meterFactory = host.Services.GetRequiredService<IMeterFactory>(); 118var meterFactory = host.Services.GetRequiredService<IMeterFactory>(); 262logger = host.Services.GetRequiredService<ILoggerFactory>().CreateLogger("Test");
Http3\Http3RequestTests.cs (2)
81var meterFactory = host.Services.GetRequiredService<IMeterFactory>(); 137var logger = context.RequestServices.GetRequiredService<ILogger<Http3RequestTests>>();
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
InteropClient (1)
InteropClient.cs (1)
107loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
IStartupInjectionAssemblyName (1)
Program.cs (1)
15var applicationName = webHost.Services.GetRequiredService<IHostEnvironment>().ApplicationName;
Microsoft.AspNetCore (5)
WebApplication.cs (5)
36Logger = host.Services.GetRequiredService<ILoggerFactory>().CreateLogger(Environment.ApplicationName ?? nameof(WebApplication)); 49public IConfiguration Configuration => _host.Services.GetRequiredService<IConfiguration>(); 54public IWebHostEnvironment Environment => _host.Services.GetRequiredService<IWebHostEnvironment>(); 59public IHostApplicationLifetime Lifetime => _host.Services.GetRequiredService<IHostApplicationLifetime>(); 77internal IFeatureCollection ServerFeatures => _host.Services.GetRequiredService<IServer>().Features;
Microsoft.AspNetCore.Antiforgery (1)
AntiforgeryServiceCollectionExtensions.cs (1)
41var provider = serviceProvider.GetRequiredService<ObjectPoolProvider>();
Microsoft.AspNetCore.Antiforgery.Test (3)
AntiforgeryOptionsSetupTest.cs (2)
28var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 53var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>();
DefaultAntiforgeryTest.cs (1)
1392var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
Microsoft.AspNetCore.AsyncState.Tests (3)
AsyncContextHttpContextOfTTests.cs (3)
25_accessorMock = serviceProvider.GetRequiredService<IHttpContextAccessor>(); 28_context = serviceProvider.GetRequiredService<IAsyncContext<Thing>>(); 29_asyncState = serviceProvider.GetRequiredService<IAsyncState>();
Microsoft.AspNetCore.Authentication (1)
AuthenticationMiddleware.cs (1)
49var handlers = context.RequestServices.GetRequiredService<IAuthenticationHandlerProvider>();
Microsoft.AspNetCore.Authentication.Core.Test (12)
AuthenticationSchemeProviderTests.cs (12)
23var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 36var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 48var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 66var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 84var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 100var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 123var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 140var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 153var error = Assert.Throws<InvalidOperationException>(() => services.GetRequiredService<IAuthenticationSchemeProvider>()); 165var o = services.GetRequiredService<IAuthenticationSchemeProvider>(); 183var provider = services.GetRequiredService<IAuthenticationSchemeProvider>(); 201var provider = services.GetRequiredService<IAuthenticationSchemeProvider>();
Microsoft.AspNetCore.Authentication.Negotiate (1)
Internal\NegotiateOptionsValidationStartupFilter.cs (1)
25var options = builder.ApplicationServices.GetRequiredService<IOptionsMonitor<NegotiateOptions>>().Get(_authenticationScheme);
Microsoft.AspNetCore.Authentication.Negotiate.Test (2)
ServerDeferralTests.cs (2)
20var options = host.Services.GetRequiredService<IOptions<NegotiateOptions>>().Value; 37var options = host.Services.GetRequiredService<IOptions<NegotiateOptions>>().Value;
Microsoft.AspNetCore.Authentication.Test (21)
CertificateTests.cs (1)
32var schemeProvider = sp.GetRequiredService<IAuthenticationSchemeProvider>();
CookieTests.cs (1)
292var options = services.BuildServiceProvider().GetRequiredService<IOptionsMonitor<CookieAuthenticationOptions>>();
DynamicSchemeTests.cs (2)
144var auth = context.RequestServices.GetRequiredService<IAuthenticationSchemeProvider>(); 157var auth = context.RequestServices.GetRequiredService<IAuthenticationSchemeProvider>();
JwtBearerTests_Handler.cs (5)
976var jwtBearerOptions = sp.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>().Get(JwtBearerDefaults.AuthenticationScheme); 1013var jwtBearerOptions = sp.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>().Get(JwtBearerDefaults.AuthenticationScheme); 1040var jwtBearerOptions = sp.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>().Get(JwtBearerDefaults.AuthenticationScheme); 1060var jwtBearerOptions = sp.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>().Get(JwtBearerDefaults.AuthenticationScheme); 1082var jwtBearerOptions = sp.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>().Get(JwtBearerDefaults.AuthenticationScheme);
OpenIdConnect\OpenIdConnectConfigurationTests.cs (1)
442var resolver = context.RequestServices.GetRequiredService<IAuthenticationHandlerProvider>();
OpenIdConnect\OpenIdConnectTests.cs (5)
443var options = sp.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>().Get(OpenIdConnectDefaults.AuthenticationScheme); 476var options = sp.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>().Get(OpenIdConnectDefaults.AuthenticationScheme); 511sp.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>().Get(OpenIdConnectDefaults.AuthenticationScheme)); 533var options = sp.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>().Get(OpenIdConnectDefaults.AuthenticationScheme); 561var options = sp.GetRequiredService<IOptionsMonitor<OpenIdConnectOptions>>().Get(OpenIdConnectDefaults.AuthenticationScheme);
SecureDataFormatTests.cs (3)
24var provider = ServiceProvider.GetRequiredService<IDataProtectionProvider>(); 37var provider = ServiceProvider.GetRequiredService<IDataProtectionProvider>(); 51var provider = ServiceProvider.GetRequiredService<IDataProtectionProvider>();
SharedAuthenticationTests.cs (1)
542var schemeProvider = sp.GetRequiredService<IAuthenticationSchemeProvider>();
WsFederation\WsFederationTest.cs (1)
33var schemeProvider = sp.GetRequiredService<IAuthenticationSchemeProvider>();
WsFederation\WsFederationTest_Handler.cs (1)
31var schemeProvider = sp.GetRequiredService<IAuthenticationSchemeProvider>();
Microsoft.AspNetCore.Authorization.Policy (2)
AuthorizationMiddleware.cs (2)
154var policyEvaluator = context.RequestServices.GetRequiredService<IPolicyEvaluator>(); 194var authorizationMiddlewareResultHandler = context.RequestServices.GetRequiredService<IAuthorizationMiddlewareResultHandler>();
Microsoft.AspNetCore.Authorization.Test (9)
AuthorizationBuilderTests.cs (6)
21var options = builder.Services.BuildServiceProvider().GetRequiredService<IOptions<AuthorizationOptions>>().Value; 37var options = builder.Services.BuildServiceProvider().GetRequiredService<IOptions<AuthorizationOptions>>().Value; 52var options = builder.Services.BuildServiceProvider().GetRequiredService<IOptions<AuthorizationOptions>>().Value; 68var options = builder.Services.BuildServiceProvider().GetRequiredService<IOptions<AuthorizationOptions>>().Value; 83var options = builder.Services.BuildServiceProvider().GetRequiredService<IOptions<AuthorizationOptions>>().Value; 97var options = builder.Services.BuildServiceProvider().GetRequiredService<IOptions<AuthorizationOptions>>().Value;
DefaultAuthorizationServiceTests.cs (1)
21return services.BuildServiceProvider().GetRequiredService<IAuthorizationService>();
PassThroughAuthorizationHandlerTests.cs (1)
19return services.BuildServiceProvider().GetRequiredService<IAuthorizationService>();
PolicyEvaluatorTests.cs (1)
166return services.BuildServiceProvider().GetRequiredService<IPolicyEvaluator>();
Microsoft.AspNetCore.Components (2)
OwningComponentBase.cs (1)
88_item ??= ScopedServices.GetRequiredService<TService>();
Routing\RouteTableFactory.cs (1)
124serviceProvider.GetRequiredService<ILoggerFactory>(),
Microsoft.AspNetCore.Components.Authorization (1)
CascadingAuthenticationStateServiceCollectionExtensions.cs (1)
24var authenticationStateProvider = services.GetRequiredService<AuthenticationStateProvider>();
Microsoft.AspNetCore.Components.Endpoints (24)
Builder\OpaqueRedirection.cs (2)
45var options = httpContext.RequestServices.GetRequiredService<IOptions<RazorComponentsServiceOptions>>(); 98var dataProtectionProvider = httpContext.RequestServices.GetRequiredService<IDataProtectionProvider>();
Builder\RazorComponentEndpointFactory.cs (1)
56var invoker = httpContext.RequestServices.GetRequiredService<IRazorComponentEndpointInvoker>();
Builder\RazorComponentsEndpointRouteBuilderExtensions.cs (1)
48var factory = endpoints.ServiceProvider.GetRequiredService<RazorComponentEndpointDataSourceFactory>();
DependencyInjection\RazorComponentsServiceCollectionExtensions.cs (5)
56services.TryAddSingleton<ServerComponentSerializer>(services => new ServerComponentSerializer(services.GetRequiredService<IDataProtectionProvider>())); 59services.TryAddScoped<IComponentPrerenderer>(services => services.GetRequiredService<EndpointHtmlRenderer>()); 65services.TryAddScoped<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State); 70services.TryAddScoped<IRoutingStateProvider>(sp => sp.GetRequiredService<EndpointRoutingStateProvider>()); 73services.TryAddCascadingValue(sp => sp.GetRequiredService<EndpointHtmlRenderer>().HttpContext);
RazorComponentEndpointInvoker.cs (1)
60var antiforgery = context.RequestServices.GetRequiredService<IAntiforgery>();
Rendering\EndpointHtmlRenderer.cs (5)
56_options = serviceProvider.GetRequiredService<IOptions<RazorComponentsServiceOptions>>().Value; 79var navigationManager = (IHostEnvironmentNavigationManager)httpContext.RequestServices.GetRequiredService<NavigationManager>(); 104httpContext.RequestServices.GetRequiredService<HttpContextFormDataProvider>() 115var componentApplicationLifetime = httpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>(); 121var routingStateProvider = httpContext.RequestServices.GetRequiredService<EndpointRoutingStateProvider>();
Rendering\EndpointHtmlRenderer.PrerenderingState.cs (5)
23var manager = _httpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>(); 44InteractiveServerRenderMode => new ProtectedPrerenderComponentApplicationStore(_httpContext.RequestServices.GetRequiredService<IDataProtectionProvider>()), 65var serverStore = new ProtectedPrerenderComponentApplicationStore(_httpContext.RequestServices.GetRequiredService<IDataProtectionProvider>()); 136var manager = _httpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>(); 143var protectedStore = new ProtectedPrerenderComponentApplicationStore(_httpContext.RequestServices.GetRequiredService<IDataProtectionProvider>());
Rendering\EndpointHtmlRenderer.Streaming.cs (2)
206var env = httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>(); 207var options = httpContext.RequestServices.GetRequiredService<IOptions<RazorComponentsServiceOptions>>();
Rendering\SSRRenderModeBoundary.cs (1)
177var serverComponentSerializer = httpContext.RequestServices.GetRequiredService<ServerComponentSerializer>();
Results\RazorComponentResultExecutor.cs (1)
47var endpointHtmlRenderer = httpContext.RequestServices.GetRequiredService<EndpointHtmlRenderer>();
Microsoft.AspNetCore.Components.Endpoints.Tests (12)
EndpointHtmlRendererTest.cs (9)
671var scope = provider.GetRequiredService<IServiceScopeFactory>().CreateScope(); 675var renderer = scopedProvider.GetRequiredService<EndpointHtmlRenderer>(); 1269var state = httpContext.RequestServices.GetRequiredService<PersistentComponentState>(); 1323var state = httpContext.RequestServices.GetRequiredService<PersistentComponentState>(); 1361var state = httpContext.RequestServices.GetRequiredService<PersistentComponentState>(); 1391var state = httpContext.RequestServices.GetRequiredService<PersistentComponentState>(); 1456var state = httpContext.RequestServices.GetRequiredService<PersistentComponentState>(); 1675services.AddSingleton(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State); 1680services.AddSingleton<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State);
RazorComponentResultTest.cs (3)
417var renderer = httpContext.RequestServices.GetRequiredService<EndpointHtmlRenderer>(); 460.AddSingleton<IComponentPrerenderer>(services => services.GetRequiredService<EndpointHtmlRenderer>()) 467.AddSingleton<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State)
Microsoft.AspNetCore.Components.Server (9)
Circuits\CircuitFactory.cs (7)
47var jsRuntime = (RemoteJSRuntime)scope.ServiceProvider.GetRequiredService<IJSRuntime>(); 50var navigationManager = (RemoteNavigationManager)scope.ServiceProvider.GetRequiredService<NavigationManager>(); 51var navigationInterception = (RemoteNavigationInterception)scope.ServiceProvider.GetRequiredService<INavigationInterception>(); 52var scrollToLocationHash = (RemoteScrollToLocationHash)scope.ServiceProvider.GetRequiredService<IScrollToLocationHash>(); 71var appLifetime = scope.ServiceProvider.GetRequiredService<ComponentStatePersistenceManager>(); 76var serverComponentDeserializer = scope.ServiceProvider.GetRequiredService<IServerComponentDeserializer>(); 111(circuitHost.Services.GetRequiredService<ICircuitAccessor>() as DefaultCircuitAccessor).Circuit = circuitHost.Circuit;
Circuits\CircuitHost.cs (1)
760var appLifetime = _scope.ServiceProvider.GetRequiredService<ComponentStatePersistenceManager>();
DependencyInjection\ComponentServiceCollectionExtensions.cs (1)
73services.TryAddScoped(s => s.GetRequiredService<ICircuitAccessor>().Circuit);
Microsoft.AspNetCore.Components.Server.Tests (4)
DependencyInjection\ComponentServiceCollectionExtensionsTest.cs (4)
21var options = services.BuildServiceProvider().GetRequiredService<IOptions<HubOptions<ComponentHub>>>(); 42var options = services.BuildServiceProvider().GetRequiredService<IOptions<HubOptions<ComponentHub>>>(); 68var options = services.BuildServiceProvider().GetRequiredService<IOptions<HubOptions<ComponentHub>>>(); 69var globalOptions = services.BuildServiceProvider().GetRequiredService<IOptions<HubOptions>>();
Microsoft.AspNetCore.Components.Tests (1)
OwningComponentBaseTest.cs (1)
19var counter = serviceProvider.GetRequiredService<Counter>();
Microsoft.AspNetCore.Components.Web (2)
Forms\Mapping\SupplyParameterFromFormServiceCollectionExtensions.cs (1)
24services.GetRequiredService<IFormValueMapper>(),
WebRenderer.cs (1)
45var jsRuntime = serviceProvider.GetRequiredService<IJSRuntime>();
Microsoft.AspNetCore.Components.Web.Tests (1)
Forms\EditFormTest.cs (1)
24services.AddSingleton(services => services.GetRequiredService<ComponentStatePersistenceManager>().State);
Microsoft.AspNetCore.Components.WebAssembly (7)
Hosting\WebAssemblyHost.cs (4)
134var manager = Services.GetRequiredService<ComponentStatePersistenceManager>(); 151var loggerFactory = Services.GetRequiredService<ILoggerFactory>(); 153var collectionProvider = Services.GetRequiredService<ResourceCollectionProvider>(); 241_scope.ServiceProvider.GetRequiredService<AntiforgeryStateProvider>();
Hosting\WebAssemblyHostBuilder.cs (2)
292var scope = services.GetRequiredService<IServiceScopeFactory>().CreateAsyncScope(); 307Services.AddSingleton<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State);
Rendering\WebAssemblyRenderer.cs (1)
34_jsMethods = serviceProvider.GetRequiredService<IInternalJSImportMethods>();
Microsoft.AspNetCore.Components.WebAssembly.Server (4)
Builder\WebAssemblyRazorComponentsEndpointConventionBuilderExtensions.cs (2)
55var environment = endpointBuilder.ServiceProvider.GetRequiredService<IWebHostEnvironment>(); 68var logger = endpointBuilder.ServiceProvider.GetRequiredService<ILogger<WebAssemblyComponentsEndpointOptions>>();
ComponentsWebAssemblyApplicationBuilderExtensions.cs (1)
38var webHostEnvironment = builder.ApplicationServices.GetRequiredService<IWebHostEnvironment>();
DebugProxyLauncher.cs (1)
60var environment = serviceProvider.GetRequiredService<IWebHostEnvironment>();
Microsoft.AspNetCore.Components.WebAssembly.Tests (12)
Hosting\WebAssemblyHostBuilderTest.cs (11)
48Assert.NotNull(host.Services.GetRequiredService<StringBuilder>()); 66Assert.NotNull(host.Services.GetRequiredService<StringBuilder>()); 88Assert.NotNull(host.Services.GetRequiredService<StringBuilder>()); 89Assert.NotNull(host.Services.GetRequiredService<List<string>>()); 105Assert.NotNull(host.Services.GetRequiredService<StringBuilder>()); 106Assert.Throws<InvalidOperationException>(() => host.Services.GetRequiredService<TestServiceThatTakesStringBuilder>()); 122Assert.NotNull(host.Services.GetRequiredService<StringBuilder>()); 123Assert.NotNull(host.Services.GetRequiredService<TestServiceThatTakesStringBuilder>()); 147var navigationManager = host.Services.GetRequiredService<NavigationManager>(); 202var configuration = host.Services.GetRequiredService<IConfiguration>(); 246var loggerProvider = host.Services.GetRequiredService<ILoggerProvider>();
Hosting\WebAssemblyHostTest.cs (1)
69var disposable = host.Services.GetRequiredService<DisposableService>();
Microsoft.AspNetCore.Components.WebView (4)
PageContext.cs (4)
41NavigationManager = (WebViewNavigationManager)ServiceProvider.GetRequiredService<NavigationManager>(); 44JSRuntime = (WebViewJSRuntime)ServiceProvider.GetRequiredService<IJSRuntime>(); 47var loggerFactory = ServiceProvider.GetRequiredService<ILoggerFactory>(); 51var webViewScrollToLocationHash = (WebViewScrollToLocationHash)ServiceProvider.GetRequiredService<IScrollToLocationHash>();
Microsoft.AspNetCore.Components.WebView.Test (1)
WebViewManagerTests.cs (1)
60var singleton = services.GetRequiredService<SingletonService>();
Microsoft.AspNetCore.DataProtection (4)
DataProtectionBuilderExtensions.cs (2)
90var implementationInstance = services.GetRequiredService<TImplementation>(); 258var certificateResolver = services.GetRequiredService<ICertificateResolver>();
DataProtectionServiceCollectionExtensions.cs (2)
85var dpOptions = s.GetRequiredService<IOptions<DataProtectionOptions>>(); 86var keyRingProvider = s.GetRequiredService<IKeyRingProvider>();
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (2)
EntityFrameworkCoreXmlRepository.cs (2)
50var context = scope.ServiceProvider.GetRequiredService<TContext>(); 70var context = scope.ServiceProvider.GetRequiredService<TContext>();
Microsoft.AspNetCore.DataProtection.Extensions (1)
DataProtectionProvider.cs (1)
143return serviceCollection.BuildServiceProvider().GetRequiredService<IDataProtectionProvider>();
Microsoft.AspNetCore.DataProtection.Extensions.Tests (2)
DataProtectionProviderTests.cs (2)
63s.GetRequiredService<IOptions<KeyManagementOptions>>(), 64s.GetRequiredService<IActivator>(),
Microsoft.AspNetCore.DataProtection.Tests (4)
ServiceCollectionTests.cs (4)
45services1.GetRequiredService<ILoggerFactory>().GetType(), 46services2.GetRequiredService<ILoggerFactory>().GetType()); 88var options = services.GetRequiredService<IOptions<KeyManagementOptions>>().Value; 121var options = services.GetRequiredService<IOptions<KeyManagementOptions>>().Value;
Microsoft.AspNetCore.Diagnostics (6)
ExceptionHandler\ExceptionHandlerExtensions.cs (5)
118var loggerFactory = app.ApplicationServices.GetRequiredService<ILoggerFactory>(); 119var diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>(); 120var exceptionHandlers = app.ApplicationServices.GetRequiredService<IEnumerable<IExceptionHandler>>(); 121var meterFactory = app.ApplicationServices.GetRequiredService<IMeterFactory>(); 125options = app.ApplicationServices.GetRequiredService<IOptions<ExceptionHandlerOptions>>();
ExceptionHandler\ExceptionHandlerMiddlewareImpl.cs (1)
147await using AsyncServiceScope? scope = _options.CreateScopeForErrors ? context.RequestServices.GetRequiredService<IServiceScopeFactory>().CreateAsyncScope() : null;
Microsoft.AspNetCore.Diagnostics.Middleware (6)
Latency\AddServerTimingHeaderMiddleware.cs (1)
36var latencyContext = httpContext.RequestServices.GetRequiredService<ILatencyContext>();
Latency\CapturePipelineEntryMiddleware.cs (1)
30var latencyContext = context.RequestServices.GetRequiredService<ILatencyContext>();
Latency\CapturePipelineExitMiddleware.cs (1)
31var latencyContext = context.RequestServices.GetRequiredService<ILatencyContext>();
Latency\CaptureResponseTimeMiddleware.cs (1)
36var latencyContext = context.RequestServices.GetRequiredService<ILatencyContext>();
Latency\RequestLatencyTelemetryMiddleware.cs (1)
59var latencyContext = context.RequestServices.GetRequiredService<ILatencyContext>();
Latency\RequestLatencyTelemetryServiceCollectionExtensions.cs (1)
40services.TryAddScoped(p => p.GetRequiredService<ILatencyContextProvider>().CreateContext());
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (19)
Latency\AcceptanceTests.cs (2)
52var latencyContext = context.RequestServices.GetRequiredService<ILatencyContext>(); 53var tokenIssuer = context.RequestServices.GetRequiredService<ILatencyContextTokenIssuer>();
Latency\ChecpointAcceptanceTests.cs (3)
30.AddScoped(p => p.GetRequiredService<ILatencyContextProvider>().CreateContext()))); 46var latencyContext = context.RequestServices.GetRequiredService<ILatencyContext>(); 82var latencyContext = context.RequestServices.GetRequiredService<ILatencyContext>();
Latency\RequestLatencyTelemetryExtensionsTests.cs (1)
62var actualOptions = serviceProvider.GetRequiredService<IOptions<RequestLatencyTelemetryOptions>>();
Logging\AcceptanceTests.cs (3)
77var fakeTimeProvider = context.RequestServices.GetRequiredService<FakeTimeProvider>(); 84var fakeTimeProvider = context.RequestServices.GetRequiredService<FakeTimeProvider>(); 119x.AddSingleton<TimeProvider>(s => s.GetRequiredService<FakeTimeProvider>());
Logging\ApiRoutingController.cs (1)
31var fakeTimeProvider = HttpContext.RequestServices.GetRequiredService<FakeTimeProvider>();
Logging\HttpLoggingServiceExtensionsTests.cs (2)
46var options = provider.GetRequiredService<IOptions<LoggingRedactionOptions>>().Value; 78var options = provider.GetRequiredService<IOptions<LoggingRedactionOptions>>().Value;
Logging\LoggingOptionsValidationTests.cs (3)
29() => services.GetRequiredService<IHttpLoggingInterceptor>()); 45() => services.GetRequiredService<IHttpLoggingInterceptor>()); 61() => services.GetRequiredService<IHttpLoggingInterceptor>());
Logging\RequestHeadersEnricherExtensionsTests.cs (4)
35Assert.Throws<ArgumentNullException>(() => sp.GetRequiredService<ILogEnricher>()); 48Assert.NotNull(serviceProvider.GetRequiredService<ILogEnricher>()); 64Assert.NotNull(serviceProvider.GetRequiredService<ILogEnricher>()); 65var options = serviceProvider.GetRequiredService<IOptions<RequestHeadersLogEnricherOptions>>().Value;
Microsoft.AspNetCore.Diagnostics.Tests (4)
DeveloperExceptionPageMiddlewareTest.cs (2)
204diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>(); 548diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>();
ExceptionHandlerTest.cs (2)
467diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>(); 520diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>();
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (3)
GrpcJsonTranscodingServiceExtensionsTests.cs (3)
22var options1 = serviceProvider.GetRequiredService<IOptions<GrpcJsonTranscodingOptions>>().Value; 26var options2 = serviceProvider.GetRequiredService<IOptions<GrpcJsonTranscodingOptions>>().Value; 47var options = serviceProvider.GetRequiredService<IOptions<GrpcJsonTranscodingOptions>>().Value;
Microsoft.AspNetCore.Grpc.Swagger (1)
GrpcSwaggerServiceExtensions.cs (1)
52return new GrpcDataContractResolver(innerContractResolver, s.GetRequiredService<DescriptorRegistry>());
Microsoft.AspNetCore.Grpc.Swagger.Tests (3)
GrpcSwaggerServiceExtensionsTests.cs (2)
40var swaggerGenerator = serviceProvider.GetRequiredService<ISwaggerProvider>(); 77var swaggerGenerator = serviceProvider.GetRequiredService<ISwaggerProvider>();
Infrastructure\OpenApiTestHelpers.cs (1)
40var swaggerGenerator = serviceProvider.GetRequiredService<ISwaggerProvider>();
Microsoft.AspNetCore.HeaderParsing (3)
HeaderParsingHttpRequestExtensions.cs (1)
29feature = context.RequestServices.GetRequiredService<HeaderParsingFeature>();
HeaderParsingServiceCollectionExtensions.cs (2)
32.AddScoped(provider => provider.GetRequiredService<ObjectPool<HeaderParsingFeature.PoolHelper>>().Get()) 33.AddScoped(provider => provider.GetRequiredService<HeaderParsingFeature.PoolHelper>().Feature)
Microsoft.AspNetCore.HeaderParsing.Tests (5)
HeaderParsingExtensionsTests.cs (5)
25var options = services.GetRequiredService<IOptions<HeaderParsingOptions>>().Value; 37Assert.Throws<OptionsValidationException>(() => services.GetRequiredService<IOptions<HeaderParsingOptions>>().Value); 47Assert.Throws<OptionsValidationException>(() => services.GetRequiredService<IOptions<HeaderParsingOptions>>().Value); 57var options = services.GetRequiredService<IOptions<HeaderParsingOptions>>().Value; 137.GetRequiredService<IHeaderRegistry>()
Microsoft.AspNetCore.HeaderPropagation (3)
DependencyInjection\HeaderPropagationHttpClientBuilderExtensions.cs (3)
31var middlewareOptions = services.GetRequiredService<IOptions<HeaderPropagationOptions>>(); 37return new HeaderPropagationMessageHandler(options, services.GetRequiredService<HeaderPropagationValues>()); 62return new HeaderPropagationMessageHandler(options, services.GetRequiredService<HeaderPropagationValues>());
Microsoft.AspNetCore.HeaderPropagation.Tests (2)
HeaderPropagationIntegrationTest.cs (2)
45var client = context.RequestServices.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 89var client = serviceProvider.GetRequiredService<IHttpClientFactory>().CreateClient("test");
Microsoft.AspNetCore.Hosting (30)
GenericHost\GenericWebHostBuilder.cs (1)
75services.TryAddSingleton<DiagnosticSource>(sp => sp.GetRequiredService<DiagnosticListener>());
GenericHost\SlimWebHostBuilder.cs (1)
49services.TryAddSingleton<DiagnosticSource>(sp => sp.GetRequiredService<DiagnosticListener>());
Http\DefaultHttpContextFactory.cs (2)
33_formOptions = serviceProvider.GetRequiredService<IOptions<FormOptions>>().Value; 34_serviceScopeFactory = serviceProvider.GetRequiredService<IServiceScopeFactory>();
Internal\StartupLoader.cs (4)
151var serviceProviderFactory = HostingServiceProvider.GetRequiredService<IServiceProviderFactory<TContainerBuilder>>(); 159var serviceProviderFactory = HostingServiceProvider.GetRequiredService<IServiceProviderFactory<IServiceCollection>>(); 175var filters = HostingServiceProvider.GetRequiredService<IEnumerable<IStartupConfigureServicesFilter>>() 221.GetRequiredService<IEnumerable<IStartupConfigureContainerFilter<TContainerBuilder>>>();
Internal\WebHost.cs (12)
129_logger = _applicationServices.GetRequiredService<ILoggerFactory>().CreateLogger("Microsoft.AspNetCore.Hosting.Diagnostics"); 134_applicationLifetime = _applicationServices.GetRequiredService<ApplicationLifetime>(); 135_hostedServiceExecutor = _applicationServices.GetRequiredService<HostedServiceExecutor>(); 140var diagnosticSource = _applicationServices.GetRequiredService<DiagnosticListener>(); 141var activitySource = _applicationServices.GetRequiredService<ActivitySource>(); 142var propagator = _applicationServices.GetRequiredService<DistributedContextPropagator>(); 143var httpContextFactory = _applicationServices.GetRequiredService<IHttpContextFactory>(); 144var hostingMetrics = _applicationServices.GetRequiredService<HostingMetrics>(); 209var builderFactory = _applicationServices.GetRequiredService<IApplicationBuilderFactory>(); 234var logger = _applicationServices.GetRequiredService<ILogger<WebHost>>(); 245var hostingEnv = _applicationServices.GetRequiredService<IHostEnvironment>(); 259Server = _applicationServices.GetRequiredService<IServer>();
WebHostBuilder.cs (3)
176var logger = host.Services.GetRequiredService<ILogger<WebHost>>(); 287services.TryAddSingleton<DiagnosticSource>(sp => sp.GetRequiredService<DiagnosticListener>()); 331var hostingEnvironment = serviceProvider.GetRequiredService<IHostEnvironment>();
WebHostBuilderExtensions.cs (4)
49return new DelegateStartup(sp.GetRequiredService<IServiceProviderFactory<IServiceCollection>>(), configureApp); 78return new DelegateStartup(sp.GetRequiredService<IServiceProviderFactory<IServiceCollection>>(), (app => configureApp(context, app))); 114var hostingEnvironment = serviceProvider.GetRequiredService<IHostEnvironment>(); 158var hostingEnvironment = sp.GetRequiredService<IHostEnvironment>();
WebHostExtensions.cs (3)
92var shutdownMessage = host.Services.GetRequiredService<WebHostOptions>().SuppressStatusMessages ? string.Empty : "Application is shutting down..."; 115var options = host.Services.GetRequiredService<WebHostOptions>(); 154var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>();
Microsoft.AspNetCore.Hosting.Tests (47)
Fakes\GenericWebHost.cs (1)
20public IFeatureCollection ServerFeatures => Services.GetRequiredService<IServer>().Features;
GenericWebHostBuilderTests.cs (2)
25var config = host.Services.GetRequiredService<IConfiguration>(); 38var config = host.Services.GetRequiredService<IConfiguration>();
Http\DefaultHttpContextFactoryTests.cs (3)
19var accessor = services.GetRequiredService<IHttpContextAccessor>(); 37var accessor = services.GetRequiredService<IHttpContextAccessor>(); 80Assert.Same(services.GetRequiredService<IServiceScopeFactory>(), context.ServiceScopeFactory);
StartupManagerTests.cs (6)
353var options = app.ApplicationServices.GetRequiredService<IOptions<FakeOptions>>().Value; 400var options = app.ApplicationServices.GetRequiredService<IOptions<FakeOptions>>().Value; 480var foo = app.ApplicationServices.GetRequiredService<StartupWithConfigureServices.IFoo>(); 498var foo = app.ApplicationServices.GetRequiredService<SimpleService>(); 743var service = app.ApplicationServices.GetRequiredService<SimpleService>(); 749var service = app.ApplicationServices.GetRequiredService<SimpleService>();
WebHostBuilderTests.cs (19)
33var options = CreateWebHostOptions(host.Services.GetRequiredService<IConfiguration>()); 225app.ApplicationServices.GetRequiredService<ServiceC>(); 250app.ApplicationServices.GetRequiredService<ServiceC>(); 481Assert.NotNull(host.Services.GetRequiredService<ServiceA>()); 482Assert.NotNull(host.Services.GetRequiredService<ServiceB>()); 498var options = CreateWebHostOptions(host.Services.GetRequiredService<IConfiguration>()); 524var options = CreateWebHostOptions(host.Services.GetRequiredService<IConfiguration>()); 550var options = CreateWebHostOptions(host.Services.GetRequiredService<IConfiguration>()); 585var options = CreateWebHostOptions(host.Services.GetRequiredService<IConfiguration>()); 678var basePath = host.Services.GetRequiredService<IHostEnvironment>().ContentRootPath; 955var startup = host.Services.GetRequiredService<StartupVerifyServiceA>(); 1076var sink = host.Services.GetRequiredService<ITestSink>(); 1092var configuration = host.Services.GetRequiredService<IConfiguration>(); 1128var configuration = host.Services.GetRequiredService<IConfiguration>(); 1229var sink = host.Services.GetRequiredService<ITestSink>(); 1244testSink = app.ApplicationServices.GetRequiredService<ITestSink>(); 1281var options = CreateWebHostOptions(host.Services.GetRequiredService<IConfiguration>()); 1337var appConfig = host.Services.GetRequiredService<IConfiguration>(); 1408var ordering = host.Services.GetRequiredService<StartOrder>();
WebHostTests.cs (16)
144var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 163var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 165var lifetime2 = host.Services.GetRequiredService<AspNetCore.Hosting.IApplicationLifetime>(); 167var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 315var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 508var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 531var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 535var svc = (TestHostedService)host.Services.GetRequiredService<IHostedService>(); 555var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 558var svc = (TestHostedService)host.Services.GetRequiredService<IHostedService>(); 598var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 651var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 742Assert.NotNull(host.Services.GetRequiredService<IOptions<object>>()); 865var env = host.Services.GetRequiredService<IHostEnvironment>(); 909var server = (FakeServer)host.Services.GetRequiredService<IServer>(); 1075var svc = (TestHostedService)host.Services.GetRequiredService<IHostedService>();
Microsoft.AspNetCore.Hosting.WindowsServices (1)
WebHostService.cs (1)
49.GetRequiredService<IHostApplicationLifetime>()
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (2)
WebHostServiceTests.cs (2)
24var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 38var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>();
Microsoft.AspNetCore.Http.Connections (1)
ConnectionEndpointRouteBuilderExtensions.cs (1)
85var dispatcher = endpoints.ServiceProvider.GetRequiredService<HttpConnectionDispatcher>();
Microsoft.AspNetCore.Http.Connections.Tests (17)
HttpConnectionDispatcherTests.cs (5)
3251var manager = host.Services.GetRequiredService<HttpConnectionManager>(); 3314var manager = host.Services.GetRequiredService<HttpConnectionManager>(); 3413var manager = host.Services.GetRequiredService<HttpConnectionManager>(); 3463var manager = host.Services.GetRequiredService<HttpConnectionManager>(); 3537var manager = host.Services.GetRequiredService<HttpConnectionManager>();
MapConnectionHandlerTests.cs (12)
45var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 82var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 109var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 137var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 168var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 197var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 227var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 259var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 297var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 333var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 367var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 415var dataSource = host.Services.GetRequiredService<EndpointDataSource>();
Microsoft.AspNetCore.Http.Extensions (1)
RequestDelegateFactory.cs (1)
2792var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
Microsoft.AspNetCore.Http.Extensions.Tests (4)
RequestDelegateFactoryTests.cs (2)
3295if (builder.ApplicationServices.GetRequiredService<MetadataService>() is { } metadataService) 3311if (builder.ApplicationServices.GetRequiredService<MetadataService>() is { } metadataService)
RequestDelegateGenerator\SharedTypes.cs (2)
631if (builder.ApplicationServices.GetRequiredService<MetadataService>() is { } metadataService) 685if (builder.ApplicationServices.GetRequiredService<MetadataService>() is { } metadataService)
Microsoft.AspNetCore.Http.Microbenchmarks (2)
src\Http\Http.Extensions\test\RequestDelegateGenerator\SharedTypes.cs (2)
631if (builder.ApplicationServices.GetRequiredService<MetadataService>() is { } metadataService) 685if (builder.ApplicationServices.GetRequiredService<MetadataService>() is { } metadataService)
Microsoft.AspNetCore.Http.Results (45)
Accepted.cs (1)
64var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
AcceptedAtRoute.cs (2)
81var linkGenerator = httpContext.RequestServices.GetRequiredService<LinkGenerator>(); 94var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
AcceptedAtRouteOfT.cs (2)
95var linkGenerator = httpContext.RequestServices.GetRequiredService<LinkGenerator>(); 108var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
AcceptedOfT.cs (1)
85var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
BadRequest.cs (1)
39var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
BadRequestOfT.cs (1)
50var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
ChallengeHttpResult.cs (1)
75var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
Conflict.cs (1)
39var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
ConflictOfT.cs (1)
50var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
ContentHttpResult.cs (1)
63var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
Created.cs (1)
64var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
CreatedAtRoute.cs (2)
81var linkGenerator = httpContext.RequestServices.GetRequiredService<LinkGenerator>(); 94var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
CreatedAtRouteOfT.cs (2)
95var linkGenerator = httpContext.RequestServices.GetRequiredService<LinkGenerator>(); 108var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
CreatedOfT.cs (1)
84var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
FileContentHttpResult.cs (1)
112var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
FileStreamHttpResult.cs (1)
118var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
ForbidHttpResult.cs (1)
86var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
InternalServerError.cs (1)
39var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
InternalServerErrorOfT.cs (1)
50var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
JsonHttpResultOfT.cs (1)
94var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
NoContent.cs (1)
38var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
NotFound.cs (1)
38var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
NotFoundOfT.cs (1)
49var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
Ok.cs (1)
38var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
OkOfT.cs (1)
49var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
PhysicalFileHttpResult.cs (1)
122var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
ProblemHttpResult.cs (1)
53var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
PushStreamHttpResult.cs (1)
106var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
RedirectHttpResult.cs (1)
94var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
RedirectToRouteHttpResult.cs (2)
161var linkGenerator = httpContext.RequestServices.GetRequiredService<LinkGenerator>(); 175var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
SignInHttpResult.cs (1)
61var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
SignOutHttpResult.cs (1)
75var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
StatusCodeHttpResult.cs (1)
42var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
UnauthorizedHttpResult.cs (1)
35var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
UnprocessableEntity.cs (1)
39var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
UnprocessableEntityOfT.cs (1)
50var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
Utf8ContentHttpResult.cs (1)
58var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
ValidationProblem.cs (1)
56var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
VirtualFileHttpResult.cs (2)
106var hostingEnvironment = httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>(); 117var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
Microsoft.AspNetCore.Http.Tests (5)
DefaultHttpContextTests.cs (5)
194var scopeFactory = serviceProvider.GetRequiredService<IServiceScopeFactory>(); 210var scopeFactory = serviceProvider.GetRequiredService<IServiceScopeFactory>(); 221instance = context.RequestServices.GetRequiredService<DisposableThing>(); 237var scopeFactory = serviceProvider.GetRequiredService<IServiceScopeFactory>(); 248instance = context.RequestServices.GetRequiredService<DisposableThing>();
Microsoft.AspNetCore.HttpOverrides.Tests (2)
CertificateForwardingTest.cs (2)
23var options = services.BuildServiceProvider().GetRequiredService<IOptions<CertificateForwardingOptions>>(); 33var options = services.BuildServiceProvider().GetRequiredService<IOptions<CertificateForwardingOptions>>();
Microsoft.AspNetCore.Identity (16)
IdentityApiEndpointRouteBuilderExtensions.cs (15)
45var timeProvider = endpoints.ServiceProvider.GetRequiredService<TimeProvider>(); 46var bearerTokenOptions = endpoints.ServiceProvider.GetRequiredService<IOptionsMonitor<BearerTokenOptions>>(); 47var emailSender = endpoints.ServiceProvider.GetRequiredService<IEmailSender<TUser>>(); 48var linkGenerator = endpoints.ServiceProvider.GetRequiredService<LinkGenerator>(); 60var userManager = sp.GetRequiredService<UserManager<TUser>>(); 67var userStore = sp.GetRequiredService<IUserStore<TUser>>(); 93var signInManager = sp.GetRequiredService<SignInManager<TUser>>(); 125var signInManager = sp.GetRequiredService<SignInManager<TUser>>(); 145var userManager = sp.GetRequiredService<UserManager<TUser>>(); 196var userManager = sp.GetRequiredService<UserManager<TUser>>(); 209var userManager = sp.GetRequiredService<UserManager<TUser>>(); 228var userManager = sp.GetRequiredService<UserManager<TUser>>(); 263var signInManager = sp.GetRequiredService<SignInManager<TUser>>(); 339var userManager = sp.GetRequiredService<UserManager<TUser>>(); 351var userManager = sp.GetRequiredService<UserManager<TUser>>();
SecurityStampValidator.cs (1)
197var validator = context.HttpContext.RequestServices.GetRequiredService<TValidator>();
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (48)
CustomSchemaTest.cs (4)
34using var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 35var db = scope.ServiceProvider.GetRequiredService<CustomVersionDbContext>(); 42using var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 43var db = scope.ServiceProvider.GetRequiredService<CustomVersionDbContext>();
DbUtil.cs (1)
39return serviceProvider.GetRequiredService<TContext>();
DefaultPocoTest.cs (4)
35using (var scoped = provider.GetRequiredService<IServiceScopeFactory>().CreateScope()) 37scoped.ServiceProvider.GetRequiredService<IdentityDbContext>().Database.EnsureCreated(); 44var userStore = _builder.ApplicationServices.GetRequiredService<IUserStore<IdentityUser>>(); 45var userManager = _builder.ApplicationServices.GetRequiredService<UserManager<IdentityUser>>();
EmptySchemaTest.cs (4)
34using var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 35var db = scope.ServiceProvider.GetRequiredService<EmptyDbContext>(); 42using var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 43var db = scope.ServiceProvider.GetRequiredService<EmptyDbContext>();
MaxKeyLengthSchemaTest.cs (4)
34using (var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) 36scope.ServiceProvider.GetRequiredService<VerstappenDbContext>().Database.EnsureCreated(); 52using (var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) 54var db = scope.ServiceProvider.GetRequiredService<VerstappenDbContext>();
UserOnlyCustomContextTest.cs (4)
79using (var scoped = provider.GetRequiredService<IServiceScopeFactory>().CreateScope()) 80using (var db = scoped.ServiceProvider.GetRequiredService<CustomContext>()) 89var userStore = _builder.ApplicationServices.GetRequiredService<IUserStore<IdentityUser>>(); 90var userManager = _builder.ApplicationServices.GetRequiredService<UserManager<IdentityUser>>();
UserOnlyTest.cs (6)
40using (var scoped = provider.GetRequiredService<IServiceScopeFactory>().CreateScope()) 41using (var db = scoped.ServiceProvider.GetRequiredService<TestUserDbContext>()) 50var userStore = _builder.ApplicationServices.GetRequiredService<IUserStore<IdentityUser>>(); 51var userManager = _builder.ApplicationServices.GetRequiredService<UserManager<IdentityUser>>(); 66var userStore = _builder.ApplicationServices.GetRequiredService<IUserStore<IdentityUser>>(); 67var manager = _builder.ApplicationServices.GetRequiredService<UserManager<IdentityUser>>();
UserStoreEncryptPersonalDataTest.cs (1)
196var dbContext = scope.ServiceProvider.GetRequiredService<TContext>();
UserStoreGuidKeyTest.cs (4)
66Assert.NotNull(sp.GetRequiredService<UserManager<GuidUser>>()); 67Assert.NotNull(sp.GetRequiredService<RoleManager<GuidRole>>()); 83Assert.NotNull(sp.GetRequiredService<UserManager<IdentityUser<Guid>>>()); 84Assert.NotNull(sp.GetRequiredService<RoleManager<IdentityRole<Guid>>>());
UserStoreIntKeyTest.cs (4)
44Assert.NotNull(sp.GetRequiredService<UserManager<IntUser>>()); 45Assert.NotNull(sp.GetRequiredService<RoleManager<IntRole>>()); 61Assert.NotNull(sp.GetRequiredService<UserManager<IdentityUser<int>>>()); 62Assert.NotNull(sp.GetRequiredService<RoleManager<IdentityRole<int>>>());
UserStoreStringKeyTest.cs (4)
45Assert.NotNull(sp.GetRequiredService<UserManager<StringUser>>()); 46Assert.NotNull(sp.GetRequiredService<RoleManager<StringRole>>()); 62Assert.NotNull(sp.GetRequiredService<UserManager<IdentityUser<string>>>()); 63Assert.NotNull(sp.GetRequiredService<RoleManager<IdentityRole<string>>>());
VersionOneSchemaTest.cs (4)
36using var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 37var db = scope.ServiceProvider.GetRequiredService<VersionOneDbContext>(); 44using var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 45var db = scope.ServiceProvider.GetRequiredService<VersionOneDbContext>();
VersionTwoSchemaTest.cs (4)
36var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 37var db = scope.ServiceProvider.GetRequiredService<VersionTwoDbContext>(); 44using var scope = _builder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope(); 45var db = scope.ServiceProvider.GetRequiredService<VersionTwoDbContext>();
Microsoft.AspNetCore.Identity.FunctionalTests (9)
MapIdentityApiTests.cs (9)
169services.AddDbContext<ApplicationDbContext>((sp, options) => options.UseSqlite(sp.GetRequiredService<SqliteConnection>())); 244services.AddDbContext<ApplicationDbContext>((sp, options) => options.UseSqlite(sp.GetRequiredService<SqliteConnection>())); 329services.AddDbContext<ApplicationDbContext>((sp, options) => options.UseSqlite(sp.GetRequiredService<SqliteConnection>())); 386var userManager = app.Services.GetRequiredService<UserManager<ApplicationUser>>(); 405var userManager = app.Services.GetRequiredService<UserManager<ApplicationUser>>(); 647await app.Services.GetRequiredService<IdentityDbContext>().Database.EnsureCreatedAsync(); 1310await app.Services.GetRequiredService<TContext>().Database.EnsureCreatedAsync(); 1324return services.AddDbContext<TContext>((sp, options) => options.UseSqlite(sp.GetRequiredService<SqliteConnection>())) 1338.AddDbContext<ApplicationDbContext>((sp, options) => options.UseSqlite(sp.GetRequiredService<SqliteConnection>()))
Microsoft.AspNetCore.Identity.InMemory.Test (7)
ControllerTest.cs (4)
48var userManager = app.ApplicationServices.GetRequiredService<UserManager<PocoUser>>(); 49var signInManager = app.ApplicationServices.GetRequiredService<SignInManager<PocoUser>>(); 98var userManager = app.ApplicationServices.GetRequiredService<UserManager<PocoUser>>(); 99var signInManager = app.ApplicationServices.GetRequiredService<SignInManager<PocoUser>>();
FunctionalTest.cs (3)
302var userManager = context.RequestServices.GetRequiredService<UserManager<PocoUser>>(); 303var roleManager = context.RequestServices.GetRequiredService<RoleManager<PocoRole>>(); 304var signInManager = context.RequestServices.GetRequiredService<SignInManager<PocoUser>>();
Microsoft.AspNetCore.Identity.Test (36)
IdentityBuilderTest.cs (26)
22Assert.NotNull(sp.GetRequiredService<IRoleValidator<PocoRole>>()); 23Assert.IsType<NoopRoleStore>(sp.GetRequiredService<IRoleStore<PocoRole>>()); 24Assert.IsType<RoleManager<PocoRole>>(sp.GetRequiredService<RoleManager<PocoRole>>()); 25Assert.NotNull(sp.GetRequiredService<RoleManager<PocoRole>>()); 26Assert.IsType<UserClaimsPrincipalFactory<PocoUser, PocoRole>>(sp.GetRequiredService<IUserClaimsPrincipalFactory<PocoUser>>()); 48Assert.NotNull(sp.GetRequiredService<IRoleValidator<PocoRole>>()); 59var thingy = services.BuildServiceProvider().GetRequiredService<IUserStore<PocoUser>>() as MyUberThingy; 69var thingy = services.BuildServiceProvider().GetRequiredService<IRoleStore<PocoRole>>() as MyUberThingy; 84var thingy = services.BuildServiceProvider().GetRequiredService<IUserClaimsPrincipalFactory<PocoUser>>() as MyClaimsPrincipalFactory; 100var thingy = services.BuildServiceProvider().GetRequiredService<IUserConfirmation<PocoUser>>() as MyUserConfirmation; 110var thingy = services.BuildServiceProvider().GetRequiredService<IRoleValidator<PocoRole>>() as MyUberThingy; 120var thingy = services.BuildServiceProvider().GetRequiredService<IUserValidator<PocoUser>>() as MyUberThingy; 130var thingy = services.BuildServiceProvider().GetRequiredService<IPasswordValidator<PocoUser>>() as MyUberThingy; 154var myRoleManager = services.BuildServiceProvider().GetRequiredService<RoleManager<PocoRole>>() as MyRoleManager; 186var userValidator = provider.GetRequiredService<IUserValidator<PocoUser>>() as UserValidator<PocoUser>; 189var pwdValidator = provider.GetRequiredService<IPasswordValidator<PocoUser>>() as PasswordValidator<PocoUser>; 192var hasher = provider.GetRequiredService<IPasswordHasher<PocoUser>>() as PasswordHasher<PocoUser>; 195Assert.IsType<RoleManager<PocoRole>>(provider.GetRequiredService<RoleManager<PocoRole>>()); 196Assert.IsType<UserManager<PocoUser>>(provider.GetRequiredService<UserManager<PocoUser>>()); 212Assert.IsType<MySignInManager>(provider.GetRequiredService<SignInManager<PocoUser>>()); 213Assert.IsType<SecurityStampValidator<PocoUser>>(provider.GetRequiredService<ISecurityStampValidator>()); 214Assert.IsType<TwoFactorSecurityStampValidator<PocoUser>>(provider.GetRequiredService<ITwoFactorSecurityStampValidator>()); 232Assert.IsType<MySignInManager>(provider.GetRequiredService<SignInManager<PocoUser>>()); 233Assert.IsType<SecurityStampValidator<PocoUser>>(provider.GetRequiredService<ISecurityStampValidator>()); 234Assert.IsType<TwoFactorSecurityStampValidator<PocoUser>>(provider.GetRequiredService<ITwoFactorSecurityStampValidator>()); 246var tokenProviders = provider.GetRequiredService<IOptions<IdentityOptions>>().Value.Tokens.ProviderMap.Values;
IdentityOptionsTest.cs (4)
44var setup = serviceProvider.GetRequiredService<IConfigureOptions<IdentityOptions>>(); 46var optionsGetter = serviceProvider.GetRequiredService<IOptions<IdentityOptions>>(); 64var optionsGetter = serviceProvider.GetRequiredService<IOptions<IdentityOptions>>(); 84var options = serviceProvider.GetRequiredService<IOptionsMonitor<CookieAuthenticationOptions>>();
UserManagerTest.cs (6)
24var manager = services.BuildServiceProvider().GetRequiredService<UserManager<PocoUser>>(); 44Assert.Same(provider.GetRequiredService<UserManager<PocoUser>>(), 45provider.GetRequiredService<CustomUserManager>()); 46Assert.Same(provider.GetRequiredService<RoleManager<PocoRole>>(), 47provider.GetRequiredService<CustomRoleManager>()); 1754var manager = services.BuildServiceProvider().GetRequiredService<UserManager<PocoUser>>();
Microsoft.AspNetCore.Identity.UI (1)
Areas\Identity\Filters\ExternalLoginsPageFilter.cs (1)
18var signInManager = context.HttpContext.RequestServices.GetRequiredService<SignInManager<TUser>>();
Microsoft.AspNetCore.InternalTesting (3)
AssemblyTestLog.cs (3)
70var factory = serviceProvider.GetRequiredService<ILoggerFactory>(); 98=> CreateLoggerServices(output, className, minLogLevel, out var _, out var _, testName, logStart).GetRequiredService<ILoggerFactory>(); 210var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
Microsoft.AspNetCore.InternalTesting.Tests (2)
LoggedTestXunitTests.cs (1)
114Assert.Same(loggerFactory, serviceCollection.BuildServiceProvider().GetRequiredService<ILoggerFactory>());
XunitLoggerProviderTest.cs (1)
91.GetRequiredService<ILoggerFactory>();
Microsoft.AspNetCore.MiddlewareAnalysis.Tests (1)
MiddlewareAnalysisTests.cs (1)
27diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>();
Microsoft.AspNetCore.Mvc.ApiExplorer (4)
DependencyInjection\EndpointMethodInfoApiExplorerServiceCollectionExtensions.cs (2)
26sp.GetRequiredService<IActionDescriptorCollectionProvider>(), 28sp.GetRequiredService<ILoggerFactory>()));
DependencyInjection\MvcApiExplorerMvcCoreBuilderExtensions.cs (2)
36sp.GetRequiredService<IActionDescriptorCollectionProvider>(), 38sp.GetRequiredService<ILoggerFactory>()));
Microsoft.AspNetCore.Mvc.Core (75)
AcceptedAtActionResult.cs (1)
75urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
AcceptedAtRouteResult.cs (1)
76urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
Authorization\AuthorizeFilter.cs (3)
145var policyProvider = PolicyProvider ?? context.HttpContext.RequestServices.GetRequiredService<IAuthorizationPolicyProvider>(); 175var policyEvaluator = context.HttpContext.RequestServices.GetRequiredService<IPolicyEvaluator>(); 206var policyProvider = serviceProvider.GetRequiredService<IAuthorizationPolicyProvider>();
Builder\ControllerEndpointRouteBuilderExtensions.cs (3)
533var orderProvider = endpoints.ServiceProvider.GetRequiredService<OrderedEndpointsSequenceProviderCache>(); 534var factory = endpoints.ServiceProvider.GetRequiredService<ControllerActionEndpointDataSourceFactory>(); 544var cache = serviceProvider.GetRequiredService<DynamicControllerEndpointSelectorCache>();
Builder\MvcApplicationBuilderExtensions.cs (2)
68var options = app.ApplicationServices.GetRequiredService<IOptions<MvcOptions>>(); 81DefaultHandler = app.ApplicationServices.GetRequiredService<MvcRouteHandler>(),
ChallengeResult.cs (1)
96var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
ContentResult.cs (1)
35var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<ContentResult>>();
ControllerBase.cs (5)
97_metadataProvider = HttpContext?.RequestServices?.GetRequiredService<IModelMetadataProvider>(); 120_modelBinderFactory = HttpContext?.RequestServices?.GetRequiredService<IModelBinderFactory>(); 143var factory = HttpContext?.RequestServices?.GetRequiredService<IUrlHelperFactory>(); 167_objectValidator = HttpContext?.RequestServices?.GetRequiredService<IObjectModelValidator>(); 190_problemDetailsFactory = HttpContext?.RequestServices?.GetRequiredService<ProblemDetailsFactory>();
CreatedAtActionResult.cs (1)
75urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
CreatedAtRouteResult.cs (1)
76urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
DependencyInjection\ApiBehaviorOptionsSetup.cs (1)
23_problemDetailsFactory ??= context.HttpContext.RequestServices.GetRequiredService<ProblemDetailsFactory>();
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (3)
211var options = s.GetRequiredService<IOptions<MvcOptions>>().Value; 217var options = s.GetRequiredService<IOptions<MvcOptions>>().Value; 218var metadataProvider = s.GetRequiredService<IModelMetadataProvider>();
DisableRequestSizeLimitAttribute.cs (1)
44var filter = serviceProvider.GetRequiredService<DisableRequestSizeLimitFilter>();
FileContentResult.cs (1)
66var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<FileContentResult>>();
FileStreamResult.cs (1)
67var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<FileStreamResult>>();
Filters\MiddlewareFilterAttribute.cs (1)
43var middlewarePipelineService = serviceProvider.GetRequiredService<MiddlewareFilterBuilder>();
Filters\MiddlewareFilterBuilderStartupFilter.cs (1)
18var middlewarePipelineBuilder = builder.ApplicationServices.GetRequiredService<MiddlewareFilterBuilder>();
ForbidResult.cs (1)
97var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
FormatFilterAttribute.cs (1)
29return serviceProvider.GetRequiredService<FormatFilter>();
Infrastructure\ModelStateInvalidFilterFactory.cs (2)
21var options = serviceProvider.GetRequiredService<IOptions<ApiBehaviorOptions>>(); 22var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
JsonResult.cs (1)
75var executor = services.GetRequiredService<IActionResultExecutor<JsonResult>>();
LocalRedirectResult.cs (1)
91var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<LocalRedirectResult>>();
ModelBinding\Binders\ArrayModelBinderProvider.cs (2)
28var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>(); 29var mvcOptions = context.Services.GetRequiredService<IOptions<MvcOptions>>().Value;
ModelBinding\Binders\ByteArrayModelBinderProvider.cs (1)
23var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\CollectionModelBinderProvider.cs (2)
60var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>(); 61var mvcOptions = context.Services.GetRequiredService<IOptions<MvcOptions>>().Value;
ModelBinding\Binders\ComplexObjectModelBinderProvider.cs (1)
24var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\ComplexTypeModelBinderProvider.cs (1)
31var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\DateTimeModelBinderProvider.cs (1)
27var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\DictionaryModelBinderProvider.cs (2)
35var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>(); 36var mvcOptions = context.Services.GetRequiredService<IOptions<MvcOptions>>().Value;
ModelBinding\Binders\EnumTypeModelBinderProvider.cs (1)
32var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\FloatingPointTypeModelBinderProvider.cs (1)
28var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\FormCollectionModelBinderProvider.cs (1)
36var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\FormFileModelBinderProvider.cs (1)
29var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\HeaderModelBinderProvider.cs (1)
29var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\KeyValuePairModelBinderProvider.cs (1)
34var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\SimpleTypeModelBinderProvider.cs (1)
23var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\Binders\TryParseModelBinderProvider.cs (1)
21var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
ModelBinding\ModelBinderFactory.cs (1)
45var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
ObjectResult.cs (1)
62var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<ObjectResult>>();
PhysicalFileResult.cs (1)
58var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<PhysicalFileResult>>();
RedirectResult.cs (1)
93var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<RedirectResult>>();
RedirectToActionResult.cs (1)
171var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<RedirectToActionResult>>();
RedirectToPageResult.cs (1)
209var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<RedirectToPageResult>>();
RedirectToRouteResult.cs (1)
163var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<RedirectToRouteResult>>();
RequestFormLimitsAttribute.cs (1)
167var filter = serviceProvider.GetRequiredService<RequestFormLimitsFilter>();
RequestSizeLimitAttribute.cs (1)
51var filter = serviceProvider.GetRequiredService<RequestSizeLimitFilter>();
RequireHttpsAttribute.cs (1)
72var optionsAccessor = filterContext.HttpContext.RequestServices.GetRequiredService<IOptions<MvcOptions>>();
ResponseCacheAttribute.cs (2)
122var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>(); 123var optionsAccessor = serviceProvider.GetRequiredService<IOptions<MvcOptions>>();
Routing\ActionEndpointFactory.cs (1)
539invokerFactory = context.RequestServices.GetRequiredService<IActionInvokerFactory>();
Routing\AttributeRoute.cs (1)
59var builder = _services.GetRequiredService<TreeRouteBuilder>();
Routing\AttributeRouting.cs (2)
22services.GetRequiredService<IActionDescriptorCollectionProvider>(), 26var handler = services.GetRequiredService<MvcAttributeRouteHandler>();
Routing\KnownRouteValueConstraint.cs (1)
75actionDescriptorsProvider = services.GetRequiredService<IActionDescriptorCollectionProvider>();
Routing\UrlHelperFactory.cs (2)
47var linkGenerator = services.GetRequiredService<LinkGenerator>(); 48var endpointDataSource = services.GetRequiredService<EndpointDataSource>();
SignInResult.cs (1)
83var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
SignOutResult.cs (1)
113var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
StatusCodeResult.cs (1)
39var factory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>();
VirtualFileResult.cs (1)
64var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<VirtualFileResult>>();
Microsoft.AspNetCore.Mvc.Core.Test (17)
ApplicationModels\EndpointMetadataProviderTest.cs (1)
275var endpointFactory = new ActionEndpointFactory(serviceProvider.GetRequiredService<RoutePatternTransformer>(), Enumerable.Empty<IRequestDelegateFactory>(), serviceProvider);
Builder\MvcApplicationBuilderExtensionsTest.cs (1)
54.GetRequiredService<EndpointDataSource>();
DependencyInjection\MvcBuilderExtensionsTest.cs (1)
155.GetRequiredService<IOptions<ApiBehaviorOptions>>()
DependencyInjection\MvcCoreBuilderExtensionsTest.cs (1)
98.GetRequiredService<IOptions<ApiBehaviorOptions>>()
FileResultHelperTest.cs (1)
499var executor = context.HttpContext.RequestServices.GetRequiredService<EmptyFileResultExecutor>();
Filters\MiddlewareFilterAttributeTest.cs (1)
19var filterBuilderService = serviceProvider.GetRequiredService<MiddlewareFilterBuilder>();
ModelBinding\Binders\HeaderModelBinderProviderTest.cs (1)
181var options = context.Services.GetRequiredService<IOptions<MvcOptions>>().Value;
Routing\ActionEndpointDataSourceBaseTest.cs (1)
149var endpointFactory = new ActionEndpointFactory(serviceProvider.GetRequiredService<RoutePatternTransformer>(), Enumerable.Empty<IRequestDelegateFactory>(), serviceProvider);
Routing\ActionEndpointFactoryTest.cs (2)
29Factory = new ActionEndpointFactory(Services.GetRequiredService<RoutePatternTransformer>(), Enumerable.Empty<IRequestDelegateFactory>(), Services); 270var factory = new ActionEndpointFactory(Services.GetRequiredService<RoutePatternTransformer>(), new[] { requestDelegateFactory.Object }, Services);
Routing\AttributeRouteTest.cs (1)
772return services.GetRequiredService<TreeRouteBuilder>();
Routing\ControllerLinkGeneratorExtensionsTest.cs (1)
227return services.GetRequiredService<LinkGenerator>();
Routing\DynamicControllerEndpointMatcherPolicyTest.cs (1)
77Comparer = Services.GetRequiredService<EndpointMetadataComparer>();
Routing\EndpointRoutingUrlHelperTest.cs (1)
143var urlHelperFactory = httpContext.RequestServices.GetRequiredService<IUrlHelperFactory>();
Routing\KnownRouteValueConstraintTests.cs (1)
38var inlineConstraintResolver = serviceProvider.GetRequiredService<IInlineConstraintResolver>();
Routing\PageLinkGeneratorExtensionsTest.cs (1)
197return services.GetRequiredService<LinkGenerator>();
VirtualFileResultTest.cs (1)
83var webHostEnvironment = httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>();
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
TestModelBinderFactory.cs (1)
15var options = serviceProvider.GetRequiredService<IOptions<MvcOptions>>();
Microsoft.AspNetCore.Mvc.Cors (1)
CorsAuthorizationFilterFactory.cs (1)
38var filter = serviceProvider.GetRequiredService<CorsAuthorizationFilter>();
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
MvcDataAnnotationsMvcOptionsSetup.cs (1)
28var optionsSetup = serviceProvider.GetRequiredService<IConfigureOptions<MvcOptions>>();
Microsoft.AspNetCore.Mvc.Formatters.Xml (2)
XmlDataContractSerializerOutputFormatter.cs (1)
224_mvcOptions ??= httpContext.RequestServices.GetRequiredService<IOptions<MvcOptions>>().Value;
XmlSerializerOutputFormatter.cs (1)
203_mvcOptions ??= httpContext.RequestServices.GetRequiredService<IOptions<MvcOptions>>().Value;
Microsoft.AspNetCore.Mvc.FunctionalTests (16)
AntiforgeryMiddlewareTest.cs (8)
36var antiforgery = app.Services.GetRequiredService<IAntiforgery>(); 37var antiforgeryOptions = app.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 120var antiforgery = app.Services.GetRequiredService<IAntiforgery>(); 121var antiforgeryOptions = app.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 152var antiforgery = app.Services.GetRequiredService<IAntiforgery>(); 153var antiforgeryOptions = app.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 184var antiforgery = app.Services.GetRequiredService<IAntiforgery>(); 185var antiforgeryOptions = app.Services.GetRequiredService<IOptions<AntiforgeryOptions>>();
AsyncDisposalTest.cs (3)
44var sink = Factory.Services.GetRequiredService<ControllerTestDisposeAsync>(); 56var sink = Factory.Services.GetRequiredService<ControllerTestDisposeAsync>(); 68var sink = Factory.Services.GetRequiredService<ControllerTestDisposeAsync>();
PageAsyncDisposalTest.cs (1)
42var sink = Factory.Services.GetRequiredService<PageTestDisposeAsync>();
SimpleWithWebApplicationBuilderTests.cs (2)
266var antiforgery = Factory.Services.GetRequiredService<IAntiforgery>(); 267var antiforgeryOptions = Factory.Services.GetRequiredService<IOptions<AntiforgeryOptions>>();
TestingInfrastructureInheritanceTests.cs (2)
87var sink = scope.ServiceProvider.GetRequiredService<DisposableService>(); 102var sink = scope.ServiceProvider.GetRequiredService<DisposableService>();
Microsoft.AspNetCore.Mvc.IntegrationTests (11)
HasValidatorsValidationMetadataProviderIntegrationTest.cs (2)
25var options = services.GetRequiredService<IOptions<MvcOptions>>(); 43var options = services.GetRequiredService<IOptions<MvcOptions>>();
ModelBindingTestHelper.cs (7)
30metadataProvider = metadataProvider ?? services.GetRequiredService<IModelMetadataProvider>(); 31var options = services.GetRequiredService<IOptions<MvcOptions>>(); 69var metadataProvider = serviceProvider.GetRequiredService<IModelMetadataProvider>(); 70var options = serviceProvider.GetRequiredService<IOptions<MvcOptions>>(); 90var options = services.GetRequiredService<IOptions<MvcOptions>>(); 119var options = services.GetRequiredService<IOptions<MvcOptions>>(); 177var optionsAccessor = services.GetRequiredService<IOptions<MvcOptions>>();
TryValidateModelIntegrationTest.cs (1)
213var options = actionContext.HttpContext.RequestServices.GetRequiredService<IOptions<MvcOptions>>();
ValidationIntegrationTests.cs (1)
2518var options = services.GetRequiredService<IOptions<MvcOptions>>().Value;
Microsoft.AspNetCore.Mvc.Localization.Test (4)
MvcLocalizationMvcBuilderExtensionsTest.cs (2)
97var actualOptions = serviceProvider.GetRequiredService<IOptions<LocalizationOptions>>(); 121var actualOptions = serviceProvider.GetRequiredService<IOptions<MvcDataAnnotationsLocalizationOptions>>();
MvcLocalizationMvcCoreBuilderExtensionsTest.cs (2)
97var actualOptions = serviceProvider.GetRequiredService<IOptions<LocalizationOptions>>(); 121var actualOptions = serviceProvider.GetRequiredService<IOptions<MvcDataAnnotationsLocalizationOptions>>();
Microsoft.AspNetCore.Mvc.NewtonsoftJson (2)
NewtonsoftJsonOutputFormatter.cs (2)
140_jsonOptions ??= context.HttpContext.RequestServices.GetRequiredService<IOptions<MvcNewtonsoftJsonOptions>>().Value; 155var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<NewtonsoftJsonOutputFormatter>>();
Microsoft.AspNetCore.Mvc.Razor (7)
RazorPageBase.cs (4)
151_tagHelperFactory = services.GetRequiredService<ITagHelperFactory>(); 165_bufferScope = services.GetRequiredService<IViewBufferScope>(); 356var factory = services.GetRequiredService<IUrlHelperFactory>(); 716var antiforgery = viewContext.HttpContext.RequestServices.GetRequiredService<IAntiforgery>();
RazorView.cs (1)
84_bufferScope = context.HttpContext.RequestServices.GetRequiredService<IViewBufferScope>();
ServiceBasedTagHelperActivator.cs (1)
21return context.HttpContext.RequestServices.GetRequiredService<TTagHelper>();
TagHelpers\TagHelperComponentTagHelper.cs (1)
62PropertyActivator = serviceProvider.GetRequiredService<ITagHelperComponentPropertyActivator>();
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (4)
DependencyInjection\RazorRuntimeCompilationMvcCoreBuilderExtensions.cs (3)
96var fileSystem = s.GetRequiredService<RazorProjectFileSystem>(); 97var csharpCompiler = s.GetRequiredService<CSharpCompiler>(); 103var referenceManager = s.GetRequiredService<RazorReferenceManager>();
PageLoaderMatcherPolicy.cs (1)
73_loader ??= httpContext.RequestServices.GetRequiredService<PageLoader>();
Microsoft.AspNetCore.Mvc.Razor.Test (8)
RazorHotReloadTest.cs (6)
22var compilerProvider = Assert.IsType<DefaultViewCompilerProvider>(serviceProvider.GetRequiredService<IViewCompilerProvider>()); 23var hotReload = serviceProvider.GetRequiredService<RazorHotReload>(); 38var viewEngine = Assert.IsType<RazorViewEngine>(serviceProvider.GetRequiredService<IRazorViewEngine>()); 39var hotReload = serviceProvider.GetRequiredService<RazorHotReload>(); 55var pageActivator = Assert.IsType<RazorPageActivator>(serviceProvider.GetRequiredService<IRazorPageActivator>()); 56var hotReload = serviceProvider.GetRequiredService<RazorHotReload>();
RazorViewEngineOptionsTest.cs (2)
34var accessor = serviceProvider.GetRequiredService<IOptions<RazorViewEngineOptions>>(); 64var accessor = serviceProvider.GetRequiredService<IOptions<RazorViewEngineOptions>>();
Microsoft.AspNetCore.Mvc.RazorPages (15)
ApplicationModels\PageConventionCollection.cs (1)
47_mvcOptions ??= _serviceProvider!.GetRequiredService<IOptions<MvcOptions>>().Value;
Builder\RazorPagesEndpointRouteBuilderExtensions.cs (3)
379var orderProviderCache = endpoints.ServiceProvider.GetRequiredService<OrderedEndpointsSequenceProviderCache>(); 380var factory = endpoints.ServiceProvider.GetRequiredService<PageActionEndpointDataSourceFactory>(); 390var cache = serviceProvider.GetRequiredService<DynamicPageEndpointSelectorCache>();
DependencyInjection\MvcRazorPagesMvcCoreBuilderExtensions.cs (1)
141services.TryAddSingleton<IPageLoader>(s => s.GetRequiredService<PageLoader>());
Filters\PageSaveTempDataPropertyFilterFactory.cs (1)
24var service = serviceProvider.GetRequiredService<PageSaveTempDataPropertyFilter>();
PageBase.cs (3)
72_metadataProvider ??= HttpContext?.RequestServices?.GetRequiredService<IModelMetadataProvider>(); 84_objectValidator = HttpContext?.RequestServices?.GetRequiredService<IObjectModelValidator>(); 97_modelBinderFactory = HttpContext?.RequestServices?.GetRequiredService<IModelBinderFactory>();
PageModel.cs (5)
97var factory = HttpContext?.RequestServices?.GetRequiredService<ITempDataDictionaryFactory>(); 120var factory = HttpContext?.RequestServices?.GetRequiredService<IUrlHelperFactory>(); 141_metadataProvider ??= HttpContext?.RequestServices?.GetRequiredService<IModelMetadataProvider>(); 158_objectValidator = HttpContext?.RequestServices?.GetRequiredService<IObjectModelValidator>(); 171_modelBinderFactory = HttpContext?.RequestServices?.GetRequiredService<IModelBinderFactory>();
PageResult.cs (1)
60var executor = context.HttpContext.RequestServices.GetRequiredService<PageResultExecutor>();
Microsoft.AspNetCore.Mvc.RazorPages.Test (3)
DependencyInjection\MvcRazorPagesMvcBuilderExtensionsTest.cs (1)
29var accessor = serviceProvider.GetRequiredService<IOptions<RazorPagesOptions>>();
Infrastructure\DynamicPageEndpointMatcherPolicyTest.cs (1)
68Comparer = Services.GetRequiredService<EndpointMetadataComparer>();
src\Mvc\Mvc.Core\test\Routing\ActionEndpointDataSourceBaseTest.cs (1)
149var endpointFactory = new ActionEndpointFactory(serviceProvider.GetRequiredService<RoutePatternTransformer>(), Enumerable.Empty<IRequestDelegateFactory>(), serviceProvider);
Microsoft.AspNetCore.Mvc.TagHelpers (5)
ComponentTagHelper.cs (1)
97var componentPrerenderer = requestServices.GetRequiredService<IComponentPrerenderer>();
ImageTagHelper.cs (1)
136FileVersionProvider = ViewContext.HttpContext.RequestServices.GetRequiredService<IFileVersionProvider>();
LinkTagHelper.cs (1)
485FileVersionProvider = ViewContext.HttpContext.RequestServices.GetRequiredService<IFileVersionProvider>();
PersistComponentStateTagHelper.cs (1)
46var componentPrerenderer = ViewContext.HttpContext.RequestServices.GetRequiredService<IComponentPrerenderer>();
ScriptTagHelper.cs (1)
473FileVersionProvider = ViewContext.HttpContext.RequestServices.GetRequiredService<IFileVersionProvider>();
Microsoft.AspNetCore.Mvc.TagHelpers.Test (5)
ComponentTagHelperTest.cs (1)
39var prerenderer = viewContext.HttpContext.RequestServices.GetRequiredService<IComponentPrerenderer>();
PersistComponentStateTagHelperTest.cs (4)
88var manager = tagHelper.ViewContext.HttpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>(); 118var manager = tagHelper.ViewContext.HttpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>(); 147var manager = tagHelper.ViewContext.HttpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>(); 200var manager = tagHelper.ViewContext.HttpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>();
Microsoft.AspNetCore.Mvc.Test (2)
MvcOptionsSetupTest.cs (1)
281return serviceProvider.GetRequiredService<IOptions<T>>().Value;
MvcServiceCollectionExtensionsTest.cs (1)
413var scopeFactory = root.GetRequiredService<IServiceScopeFactory>();
Microsoft.AspNetCore.Mvc.Testing (2)
DeferredHostBuilder.cs (1)
152using var reg2 = _host.Services.GetRequiredService<IHostApplicationLifetime>().ApplicationStarted.UnsafeRegister(_ => _hostStartedTcs.TrySetResult(), null);
WebApplicationFactory.cs (1)
214_server = (TestServer)_host.Services.GetRequiredService<IServer>();
Microsoft.AspNetCore.Mvc.ViewFeatures (26)
AutoValidateAntiforgeryTokenAttribute.cs (1)
49return serviceProvider.GetRequiredService<AutoValidateAntiforgeryTokenAuthorizationFilter>();
Controller.cs (1)
71var factory = HttpContext?.RequestServices?.GetRequiredService<ITempDataDictionaryFactory>();
DefaultDisplayTemplates.cs (5)
93var metadataProvider = serviceProvider.GetRequiredService<IModelMetadataProvider>(); 108var viewEngine = serviceProvider.GetRequiredService<ICompositeViewEngine>(); 109var viewBufferScope = serviceProvider.GetRequiredService<IViewBufferScope>(); 209var viewEngine = serviceProvider.GetRequiredService<ICompositeViewEngine>(); 210var viewBufferScope = serviceProvider.GetRequiredService<IViewBufferScope>();
DefaultEditorTemplates.cs (5)
75var metadataProvider = serviceProvider.GetRequiredService<IModelMetadataProvider>(); 90var viewEngine = serviceProvider.GetRequiredService<ICompositeViewEngine>(); 91var viewBufferScope = serviceProvider.GetRequiredService<IViewBufferScope>(); 251var viewEngine = serviceProvider.GetRequiredService<ICompositeViewEngine>(); 252var viewBufferScope = serviceProvider.GetRequiredService<IViewBufferScope>();
DependencyInjection\MvcViewFeaturesMvcCoreBuilderExtensions.cs (1)
161services.TryAddSingleton<IModelExpressionProvider>(s => s.GetRequiredService<ModelExpressionProvider>());
Filters\ControllerSaveTempDataPropertyFilterFactory.cs (1)
24var service = serviceProvider.GetRequiredService<ControllerSaveTempDataPropertyFilter>();
PageRemoteAttribute.cs (1)
44var factory = services.GetRequiredService<IUrlHelperFactory>();
RemoteAttribute.cs (1)
112var factory = services.GetRequiredService<IUrlHelperFactory>();
RemoteAttributeBase.cs (1)
180var options = services.GetRequiredService<IOptions<MvcDataAnnotationsLocalizationOptions>>();
Rendering\HtmlHelperComponentExtensions.cs (1)
63var componentRenderer = httpContext.RequestServices.GetRequiredService<IComponentPrerenderer>();
SaveTempDataAttribute.cs (1)
38return serviceProvider.GetRequiredService<SaveTempDataFilter>();
TemplateRenderer.cs (1)
240var newHelper = viewContext.HttpContext.RequestServices.GetRequiredService<IHtmlHelper>();
ValidateAntiForgeryTokenAttribute.cs (1)
48return serviceProvider.GetRequiredService<ValidateAntiforgeryTokenAuthorizationFilter>();
ViewComponent.cs (2)
88var factory = services?.GetRequiredService<IUrlHelperFactory>(); 152_viewEngine = services?.GetRequiredService<ICompositeViewEngine>();
ViewComponentResultExecutor.cs (1)
113var viewComponentHelper = context.HttpContext.RequestServices.GetRequiredService<IViewComponentHelper>();
ViewComponents\ViewViewComponentResult.cs (2)
113_diagnosticListener = viewContext.HttpContext.RequestServices.GetRequiredService<DiagnosticListener>(); 131return context.ViewContext.HttpContext.RequestServices.GetRequiredService<ICompositeViewEngine>();
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (6)
PageRemoteAttributeTest.cs (1)
193provider => new DefaultInlineConstraintResolver(provider.GetRequiredService<IOptions<RouteOptions>>(), provider));
RemoteAttributeBaseTest.cs (4)
224.GetRequiredService<IOptions<MvcDataAnnotationsLocalizationOptions>>(); 271.GetRequiredService<IOptions<MvcDataAnnotationsLocalizationOptions>>(); 316.GetRequiredService<IOptions<MvcDataAnnotationsLocalizationOptions>>(); 408.GetRequiredService<IOptions<MvcDataAnnotationsLocalizationOptions>>();
RemoteAttributeTest.cs (1)
494provider => new DefaultInlineConstraintResolver(provider.GetRequiredService<IOptions<RouteOptions>>(), provider));
Microsoft.AspNetCore.OpenApi (1)
Extensions\OpenApiEndpointRouteBuilderExtensions.cs (1)
30var options = endpoints.ServiceProvider.GetRequiredService<IOptionsMonitor<OpenApiOptions>>();
Microsoft.AspNetCore.OpenApi.Tests (24)
Extensions\OpenApiServiceCollectionExtensionsTests.cs (6)
41var options = serviceProvider.GetRequiredService<IOptionsSnapshot<OpenApiOptions>>(); 75var options = serviceProvider.GetRequiredService<IOptionsSnapshot<OpenApiOptions>>(); 108var options = serviceProvider.GetRequiredService<IOptionsSnapshot<OpenApiOptions>>(); 141var options = serviceProvider.GetRequiredService<IOptionsSnapshot<OpenApiOptions>>(); 163var options = serviceProvider.GetRequiredService<IOptionsSnapshot<OpenApiOptions>>(); 187var options = serviceProvider.GetRequiredService<IOptionsSnapshot<OpenApiOptions>>();
Transformers\DocumentTransformerTests.cs (6)
175var service = context.ApplicationServices.GetRequiredService<Dependency>(); 176var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>(); 203var service = context.ApplicationServices.GetRequiredService<Dependency>(); 204var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>(); 230var service = context.ApplicationServices.GetRequiredService<Dependency>(); 231var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>();
Transformers\OperationTransformerTests.cs (6)
413var service = context.ApplicationServices.GetRequiredService<Dependency>(); 414var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>(); 440var service = context.ApplicationServices.GetRequiredService<Dependency>(); 441var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>(); 468var service = context.ApplicationServices.GetRequiredService<Dependency>(); 469var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>();
Transformers\SchemaTransformerTests.cs (6)
770var service = context.ApplicationServices.GetRequiredService<Dependency>(); 771var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>(); 797var service = context.ApplicationServices.GetRequiredService<Dependency>(); 798var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>(); 824var service = context.ApplicationServices.GetRequiredService<Dependency>(); 825var sameServiceAgain = context.ApplicationServices.GetRequiredService<Dependency>();
Microsoft.AspNetCore.OutputCaching (1)
OutputCacheServiceCollectionExtensions.cs (1)
33var outputCacheOptions = sp.GetRequiredService<IOptions<OutputCacheOptions>>();
Microsoft.AspNetCore.RateLimiting.Tests (2)
RateLimitingMetricsTests.cs (2)
187serviceProvider.GetRequiredService<IOptions<RateLimiterOptions>>(), 262serviceProvider.GetRequiredService<IOptions<RateLimiterOptions>>(),
Microsoft.AspNetCore.ResponseCompression (1)
ResponseCompressionProvider.cs (1)
71_logger = services.GetRequiredService<ILogger<ResponseCompressionProvider>>();
Microsoft.AspNetCore.Rewrite (3)
RewriteBuilderExtensions.cs (3)
54options = app.ApplicationServices.GetRequiredService<IOptions<RewriteOptions>>(); 57var webHostEnv = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>(); 58var loggerFactory = app.ApplicationServices.GetRequiredService<ILoggerFactory>();
Microsoft.AspNetCore.Routing (17)
Builder\EndpointRoutingApplicationBuilderExtensions.cs (1)
104var routeOptions = builder.ApplicationServices.GetRequiredService<IOptions<RouteOptions>>();
DefaultLinkGenerator.cs (2)
184var addressingScheme = _serviceProvider.GetRequiredService<IEndpointAddressScheme<TAddress>>(); 327private IReadOnlyList<Endpoint> Endpoints => _serviceProvider.GetRequiredService<EndpointDataSource>().Endpoints;
DefaultLinkParser.cs (1)
72var addressingScheme = _serviceProvider.GetRequiredService<IEndpointAddressScheme<TAddress>>();
DependencyInjection\RoutingServiceCollectionExtensions.cs (4)
53var provider = s.GetRequiredService<ObjectPoolProvider>(); 61var loggerFactory = s.GetRequiredService<ILoggerFactory>(); 62var objectPool = s.GetRequiredService<ObjectPool<UriBuildingContext>>(); 63var constraintResolver = s.GetRequiredService<IInlineConstraintResolver>();
Internal\DfaGraphWriter.cs (1)
42var builder = _services.GetRequiredService<DfaMatcherBuilder>();
MapRouteRouteBuilderExtensions.cs (2)
132.GetRequiredService<IInlineConstraintResolver>(); 135.GetRequiredService<ParameterPolicyFactory>();
Matching\DfaMatcherFactory.cs (2)
27var lifetime = _services.GetRequiredService<DataSourceDependentMatcher.Lifetime>(); 29return new DataSourceDependentMatcher(dataSource, lifetime, _services.GetRequiredService<DfaMatcherBuilder>);
RequestDelegateRouteBuilderExtensions.cs (1)
299return builder.ServiceProvider.GetRequiredService<IInlineConstraintResolver>();
RouteBase.cs (2)
293var binderFactory = context.RequestServices.GetRequiredService<TemplateBinderFactory>(); 318var factory = context.RequestServices.GetRequiredService<ILoggerFactory>();
RouteCollection.cs (1)
195_options = context.RequestServices.GetRequiredService<IOptions<RouteOptions>>().Value;
Microsoft.AspNetCore.Routing.FunctionalTests (14)
MinimalFormTests.cs (14)
50var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 51var antiforgeryOptions = host.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 110var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 111var antiforgeryOptions = host.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 471var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 472var antiforgeryOptions = host.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 530var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 531var antiforgeryOptions = host.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 582var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 583var antiforgeryOptions = host.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 634var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 635var antiforgeryOptions = host.Services.GetRequiredService<IOptions<AntiforgeryOptions>>(); 683var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 684var antiforgeryOptions = host.Services.GetRequiredService<IOptions<AntiforgeryOptions>>();
Microsoft.AspNetCore.Routing.Microbenchmarks (13)
EndpointRoutingBenchmarkBase.cs (1)
42return CreateServices().GetRequiredService<DfaMatcherBuilder>();
LinkGeneration\LinkGenerationGithubBenchmark.cs (2)
24_linkGenerator = services.GetRequiredService<LinkGenerator>(); 27var treeRouteBuilder = services.GetRequiredService<TreeRouteBuilder>();
LinkGeneration\SingleRouteRouteValuesAddressSchemeBenchmark.cs (1)
25_implementation = services.GetRequiredService<IEndpointAddressScheme<RouteValuesAddress>>();
LinkGeneration\SingleRouteWithConstraintsBenchmark.cs (2)
27_linkGenerator = services.GetRequiredService<LinkGenerator>(); 30var treeRouteBuilder = services.GetRequiredService<TreeRouteBuilder>();
LinkGeneration\SingleRouteWithNoParametersBenchmark.cs (2)
27_linkGenerator = services.GetRequiredService<LinkGenerator>(); 30var treeRouteBuilder = services.GetRequiredService<TreeRouteBuilder>();
LinkGeneration\SingleRouteWithParametersBenchmark.cs (2)
27_linkGenerator = services.GetRequiredService<LinkGenerator>(); 30var treeRouteBuilder = services.GetRequiredService<TreeRouteBuilder>();
Matching\MatcherBuilderAzureBenchmark.cs (1)
26var builder = _services.GetRequiredService<DfaMatcherBuilder>();
Matching\MatcherBuilderGithubBenchmark.cs (1)
26var builder = _services.GetRequiredService<DfaMatcherBuilder>();
Matching\MatcherBuilderMultipleEntryBenchmark.cs (1)
74var builder = _services.GetRequiredService<DfaMatcherBuilder>();
Microsoft.AspNetCore.Routing.Tests (21)
Builder\EndpointRoutingApplicationBuilderExtensionsTest.cs (3)
221var compositeEndpointBuilder = services.GetRequiredService<EndpointDataSource>(); 287var compositeEndpointBuilder = services.GetRequiredService<EndpointDataSource>(); 323var routeOptions = app.ApplicationServices.GetRequiredService<IOptions<RouteOptions>>();
InlineRouteParameterParserTests.cs (1)
965var accessor = serviceProvider.GetRequiredService<IOptions<RouteOptions>>();
LinkGeneratorTestBase.cs (2)
71var routeOptions = serviceProvider.GetRequiredService<IOptions<RouteOptions>>(); 74serviceProvider.GetRequiredService<TemplateBinderFactory>(),
LinkParserTestBase.cs (2)
63var routeOptions = serviceProvider.GetRequiredService<IOptions<RouteOptions>>(); 68serviceProvider.GetRequiredService<ILoggerFactory>().CreateLogger<DefaultLinkParser>(),
Matching\DfaMatcherConformanceTest.cs (1)
70var builder = services.GetRequiredService<DfaMatcherBuilder>();
Matching\DfaMatcherTest.cs (1)
57var factory = services.GetRequiredService<MatcherFactory>();
Matching\HostMatcherPolicyIntegrationTestBase.cs (1)
375var builder = services.GetRequiredService<DfaMatcherBuilder>();
Matching\HttpMethodMatcherPolicyIntegrationTestBase.cs (1)
354var builder = services.GetRequiredService<DfaMatcherBuilder>();
Patterns\DefaultRoutePatternTransformerTest.cs (1)
16Transformer = services.BuildServiceProvider().GetRequiredService<RoutePatternTransformer>();
RouteHandlerOptionsTests.cs (3)
29var options = serviceProvider.GetRequiredService<IOptions<RouteHandlerOptions>>().Value; 53var options = serviceProvider.GetRequiredService<IOptions<RouteHandlerOptions>>().Value; 65var options = serviceProvider.GetRequiredService<IOptions<RouteHandlerOptions>>();
RouteOptionsTests.cs (3)
24var accessor = serviceProvider.GetRequiredService<IOptions<RouteOptions>>(); 40var options = serviceProvider.GetRequiredService<IOptions<RouteOptions>>().Value; 41var endpointDataSource = serviceProvider.GetRequiredService<EndpointDataSource>();
TemplateParserDefaultValuesTests.cs (1)
148var accessor = serviceProvider.GetRequiredService<IOptions<RouteOptions>>();
Tree\TreeRouteBuilderTest.cs (1)
259var accessor = serviceProvider.GetRequiredService<IOptions<RouteOptions>>();
Microsoft.AspNetCore.Server.HttpSys (3)
WebHostBuilderHttpSysExtensions.cs (3)
32services.AddSingleton<IServer>(services => services.GetRequiredService<MessagePump>()); 35services.AddSingleton<IServerDelegationFeature>(services => services.GetRequiredService<MessagePump>()); 40var options = services.GetRequiredService<IOptions<HttpSysOptions>>().Value;
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (3)
DelegateTests.cs (2)
30var server = host.Services.GetRequiredService<IServer>(); 31var delegationFeature = host.Services.GetRequiredService<IServerDelegationFeature>();
Utilities.cs (1)
106var options = host.Services.GetRequiredService<IOptions<HttpSysOptions>>();
Microsoft.AspNetCore.Server.IISIntegration.Tests (5)
IISMiddlewareTests.cs (5)
117var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>(); 176var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>(); 221var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>(); 266var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>(); 408var auth = context.RequestServices.GetRequiredService<IAuthenticationSchemeProvider>();
Microsoft.AspNetCore.Server.Kestrel.Core (17)
KestrelServerOptions.cs (9)
295Debug.Assert(ApplicationServices.GetRequiredService<IHttpsConfigurationService>().IsInitialized, "HTTPS configuration should have been enabled"); 313var logger = ApplicationServices!.GetRequiredService<ILogger<KestrelServer>>(); 322var httpsConfigurationService = ApplicationServices.GetRequiredService<IHttpsConfigurationService>(); 326var hostEnvironment = ApplicationServices.GetRequiredService<IHostEnvironment>(); 327var logger = ApplicationServices.GetRequiredService<ILogger<KestrelServer>>(); 328var httpsLogger = ApplicationServices.GetRequiredService<ILogger<HttpsConnectionMiddleware>>(); 458var httpsConfigurationService = ApplicationServices.GetRequiredService<IHttpsConfigurationService>(); 461ApplicationServices.GetRequiredService<IHostEnvironment>(), 462ApplicationServices.GetRequiredService<ILogger<CertificatePathWatcher>>())
ListenOptionsHttpsExtensions.cs (7)
38var env = listenOptions.ApplicationServices.GetRequiredService<IHostEnvironment>(); 52var env = listenOptions.ApplicationServices.GetRequiredService<IHostEnvironment>(); 67var env = listenOptions.ApplicationServices.GetRequiredService<IHostEnvironment>(); 194var loggerFactory = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService<ILoggerFactory>(); 195var metrics = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService<KestrelMetrics>(); 257var loggerFactory = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService<ILoggerFactory>(); 258var metrics = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService<KestrelMetrics>();
Middleware\ListenOptionsConnectionLoggingExtensions.cs (1)
36var loggerFactory = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService<ILoggerFactory>();
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (3)
KestrelServerTests.cs (3)
301serviceProvider.GetRequiredService<IHostEnvironment>(), 302serviceProvider.GetRequiredService<ILogger<KestrelServer>>(), 303serviceProvider.GetRequiredService<ILogger<HttpsConnectionMiddleware>>());
Microsoft.AspNetCore.Server.Kestrel.Tests (2)
HttpsConfigurationTests.cs (2)
208Assert.True(host.Services.GetRequiredService<IHttpsConfigurationService>().IsInitialized); 235Assert.False(host.Services.GetRequiredService<IHttpsConfigurationService>().IsInitialized);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
Microsoft.AspNetCore.SignalR.Client.Core (1)
HubConnectionBuilder.cs (1)
55return serviceProvider.GetRequiredService<HubConnection>();
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (6)
HubConnectionTests.Tracing.cs (6)
37var serverSource = server.Services.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 232var serverSource = server.Services.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 376var serverSource = server.Services.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 479var serverSource = server.Services.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 575var serverSource = server.Services.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 665var serverSource = server.Services.GetRequiredService<SignalRServerActivitySource>().ActivitySource;
Microsoft.AspNetCore.SignalR.Core (5)
Internal\DefaultHubDispatcher.cs (5)
87var hubActivator = scope.ServiceProvider.GetRequiredService<IHubActivator<THub>>(); 123var hubActivator = scope.ServiceProvider.GetRequiredService<IHubActivator<THub>>(); 330hubActivator = scope.ServiceProvider.GetRequiredService<IHubActivator<THub>>(); 678var authService = provider.GetRequiredService<IAuthorizationService>(); 679var policyProvider = provider.GetRequiredService<IAuthorizationPolicyProvider>();
Microsoft.AspNetCore.SignalR.Tests (54)
AddSignalRTests.cs (25)
40Assert.IsType<CustomIdProvider>(serviceProvider.GetRequiredService<IUserIdProvider>()); 41Assert.IsType<CustomHubLifetimeManager<CustomHub>>(serviceProvider.GetRequiredService<HubLifetimeManager<CustomHub>>()); 42Assert.IsType<CustomHubProtocolResolver>(serviceProvider.GetRequiredService<IHubProtocolResolver>()); 43Assert.IsType<CustomHubActivator<CustomHub>>(serviceProvider.GetRequiredService<IHubActivator<CustomHub>>()); 44Assert.IsType<CustomHubContext<CustomHub>>(serviceProvider.GetRequiredService<IHubContext<CustomHub>>()); 45Assert.IsType<CustomHubContext<CustomTHub, string>>(serviceProvider.GetRequiredService<IHubContext<CustomTHub, string>>()); 46Assert.IsType<CustomHubContext<CustomDynamicHub>>(serviceProvider.GetRequiredService<IHubContext<CustomDynamicHub>>()); 47Assert.Equal(hubOptions, serviceProvider.GetRequiredService<IConfigureOptions<HubOptions>>()); 48Assert.Equal(markerService, serviceProvider.GetRequiredService<SignalRCoreMarkerService>()); 65Assert.IsType<CustomIdProvider>(serviceProvider.GetRequiredService<IUserIdProvider>()); 66Assert.IsType<CustomHubLifetimeManager<CustomHub>>(serviceProvider.GetRequiredService<HubLifetimeManager<CustomHub>>()); 67Assert.IsType<CustomHubProtocolResolver>(serviceProvider.GetRequiredService<IHubProtocolResolver>()); 68Assert.IsType<CustomHubActivator<CustomHub>>(serviceProvider.GetRequiredService<IHubActivator<CustomHub>>()); 69Assert.IsType<CustomHubContext<CustomHub>>(serviceProvider.GetRequiredService<IHubContext<CustomHub>>()); 70Assert.IsType<CustomHubContext<CustomTHub, string>>(serviceProvider.GetRequiredService<IHubContext<CustomTHub, string>>()); 71Assert.IsType<CustomHubContext<CustomDynamicHub>>(serviceProvider.GetRequiredService<IHubContext<CustomDynamicHub>>()); 86Assert.Single(serviceProvider.GetRequiredService<IOptions<HubOptions>>().Value.SupportedProtocols); 87Assert.Empty(serviceProvider.GetRequiredService<IOptions<HubOptions<CustomHub>>>().Value.SupportedProtocols); 89Assert.Null(serviceProvider.GetRequiredService<IOptions<HubOptions>>().Value.HubFilters); 90Assert.Single(serviceProvider.GetRequiredService<IOptions<HubOptions<CustomHub>>>().Value.HubFilters); 103var hubOptions = serviceProvider.GetRequiredService<IOptions<HubOptions<CustomHub>>>().Value; 104var globalHubOptions = serviceProvider.GetRequiredService<IOptions<HubOptions>>().Value; 130Assert.Equal(42, serviceProvider.GetRequiredService<IOptions<HubOptions<CustomHub>>>().Value.StreamBufferCapacity); 156var globalOptions = serviceProvider.GetRequiredService<IOptions<HubOptions>>().Value; 182Assert.Collection(serviceProvider.GetRequiredService<IOptions<HubOptions<CustomHub>>>().Value.SupportedProtocols,
HubConnectionHandlerTests.Activity.cs (8)
33var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 108var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 177var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 236var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 309var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 356var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 408var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource; 459var signalrSource = serviceProvider.GetRequiredService<SignalRServerActivitySource>().ActivitySource;
HubConnectionHandlerTests.ClientResult.cs (4)
145var context = serviceProvider.GetRequiredService<IHubContext<MethodHub>>(); 178var context = serviceProvider.GetRequiredService<IHubContext<HubT, ITest>>(); 370var context = serviceProvider.GetRequiredService<IHubContext<HubT, ITest>>(); 415var context = serviceProvider.GetRequiredService<IHubContext<MethodHub>>();
HubConnectionHandlerTests.cs (8)
221var context = serviceProvider.GetRequiredService<IHubContext<SimpleHub>>(); 232var context = serviceProvider.GetRequiredService<IHubContext<SimpleTypedHub, ITypedHubClient>>(); 244serviceProvider.GetRequiredService<IHubContext<SimpleVoidReturningTypedHub, IVoidReturningTypedHubClient>>()); 2457var msgPackOptions = serviceProvider.GetRequiredService<IOptions<MessagePackHubProtocolOptions>>(); 2495var msgPackOptions = serviceProvider.GetRequiredService<IOptions<MessagePackHubProtocolOptions>>(); 2519var msgPackOptions = serviceProvider.GetRequiredService<IOptions<MessagePackHubProtocolOptions>>(); 4547IHubContext context = (IHubContext)serviceProvider.GetRequiredService<IHubContext<MethodHub>>(); 4637IHubContext<TestHub> context = serviceProvider.GetRequiredService<IHubContext<MethodHub>>();
MapSignalRTests.cs (9)
84var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 117var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 156var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 185var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 214var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 246var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 278var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 317var dataSource = host.Services.GetRequiredService<EndpointDataSource>(); 348var dataSource = host.Services.GetRequiredService<EndpointDataSource>();
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
src\Shared\SignalR\InProcessTestServer.cs (1)
131_lifetime = _host.Services.GetRequiredService<IHostApplicationLifetime>();
Microsoft.AspNetCore.SpaServices.Extensions (8)
AngularCli\AngularCliBuilder.cs (2)
49var applicationStoppingToken = appBuilder.ApplicationServices.GetRequiredService<IHostApplicationLifetime>().ApplicationStopping; 53var diagnosticSource = appBuilder.ApplicationServices.GetRequiredService<DiagnosticSource>();
AngularCli\AngularCliMiddleware.cs (2)
38var applicationStoppingToken = appBuilder.ApplicationServices.GetRequiredService<IHostApplicationLifetime>().ApplicationStopping; 40var diagnosticSource = appBuilder.ApplicationServices.GetRequiredService<DiagnosticSource>();
Proxying\SpaProxyingExtensions.cs (1)
86.GetRequiredService<IHostApplicationLifetime>();
ReactDevelopmentServer\ReactDevelopmentServerMiddleware.cs (2)
38var applicationStoppingToken = appBuilder.ApplicationServices.GetRequiredService<IHostApplicationLifetime>().ApplicationStopping; 40var diagnosticSource = appBuilder.ApplicationServices.GetRequiredService<DiagnosticSource>();
StaticFiles\DefaultSpaStaticFileProvider.cs (1)
30var env = serviceProvider.GetRequiredService<IWebHostEnvironment>();
Microsoft.AspNetCore.StaticAssets (9)
Development\StaticAssetDevelopmentRuntimeHandler.cs (5)
44var fileInfo = context.RequestServices.GetRequiredService<IWebHostEnvironment>().WebRootFileProvider.GetFileInfo(asset.AssetPath); 95var fileInfo = _context.RequestServices.GetRequiredService<IWebHostEnvironment>().WebRootFileProvider.GetFileInfo(_asset.AssetPath); 160var config = serviceProvider.GetRequiredService<IConfiguration>(); 171var config = endpoints.ServiceProvider.GetRequiredService<IConfiguration>(); 193var logger = endpoints.ServiceProvider.GetRequiredService<ILogger<StaticAssetDevelopmentRuntimeHandler>>();
Infrastructure\StaticAssetsEndpointDataSourceHelper.cs (1)
59var environment = services.GetRequiredService<IWebHostEnvironment>();
StaticAssetsEndpointRouteBuilderExtensions.cs (2)
30var environment = endpoints.ServiceProvider.GetRequiredService<IWebHostEnvironment>(); 91var environment = endpoints.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
StaticAssetsInvoker.cs (1)
165var environment = context.RequestServices.GetRequiredService<IWebHostEnvironment>();
Microsoft.AspNetCore.StaticFiles.FunctionalTests (3)
FallbackStaticFileTest.cs (3)
37var environment = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>(); 56var environment = host.Services.GetRequiredService<IWebHostEnvironment>(); 105var environment = host.Services.GetRequiredService<IWebHostEnvironment>();
Microsoft.AspNetCore.TestHost (2)
HostBuilderTestServerExtensions.cs (1)
23return (TestServer)host.Services.GetRequiredService<IServer>();
WebHostBuilderExtensions.cs (1)
56return (TestServer)host.Services.GetRequiredService<IServer>();
Microsoft.AspNetCore.TestHost.Tests (10)
TestServerTests.cs (10)
147$"{ctx.RequestServices.GetRequiredService<SimpleService>().Message}, {ctx.RequestServices.GetRequiredService<TestService>().Message}")); 188Assert.Equal(testService, server.Host.Services.GetRequiredService<TestService>()); 455var s = context.RequestServices.GetRequiredService<TestService>(); 562var logger = app.ApplicationServices.GetRequiredService<ILogger<HttpContext>>(); 579var accessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>(); 610var accessor = app.ApplicationServices.GetRequiredService<ContextHolder>(); 728diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>(); 755diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>(); 905var service = app.ApplicationServices.GetRequiredService<SimpleService>();
Microsoft.AspNetCore.Testing (2)
ServiceFakesHostExtensions.cs (2)
40var uri = GetListenUris(host.Services.GetRequiredService<IServer>()).FirstOrDefault(addressFilter) 65return GetListenUris(Throw.IfNull(host).Services.GetRequiredService<IServer>());
Microsoft.AspNetCore.Testing.Tests (2)
FakesExtensionsTests.cs (2)
56var certificate = host.Services.GetRequiredService<IOptions<FakeCertificateOptions>>().Value.Certificate; 197hostMock.Object.Services.GetRequiredService<IServer>().Features[typeof(IServerAddressesFeature)] = null;
Microsoft.AspNetCore.Tests (35)
WebApplicationTests.cs (32)
950var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 951var webHostEnv = app.Services.GetRequiredService<IWebHostEnvironment>(); 992var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 993var webHostEnv = app.Services.GetRequiredService<IWebHostEnvironment>(); 1060var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 1061var webHostEnv = app.Services.GetRequiredService<IWebHostEnvironment>(); 1362var config = app.Services.GetRequiredService<IConfiguration>(); 1363var monitor = app.Services.GetRequiredService<IOptionsMonitor<HostFilteringOptions>>(); 1478var env0 = app.Services.GetRequiredService<IHostEnvironment>(); 1480var env1 = app.Services.GetRequiredService<IServiceCollection>().BuildServiceProvider().GetRequiredService<IHostEnvironment>(); 1508var service0 = app.Services.GetRequiredService<IService>(); 1510var service1 = app.Services.GetRequiredService<IServiceCollection>().BuildServiceProvider().GetRequiredService<IService>(); 1558var hostLifetime0 = app.Services.GetRequiredService<IHostLifetime>(); 1559var childServiceProvider = app.Services.GetRequiredService<IServiceCollection>().BuildServiceProvider(); 1560var hostLifetime1 = childServiceProvider.GetRequiredService<IHostLifetime>(); 1596var endpointDataSource = app.Services.GetRequiredService<EndpointDataSource>(); 1630var logger = app.Services.GetRequiredService<ILogger<WebApplicationTests>>(); 1650var logger = app.Services.GetRequiredService<ILogger<WebApplicationTests>>(); 1762Assert.Single(app.Services.GetRequiredService<IEnumerable<IConfigureOptions<LoggerFactoryOptions>>>()); 1763Assert.Single(app.Services.GetRequiredService<IEnumerable<IWebHostEnvironment>>()); 1764Assert.Single(app.Services.GetRequiredService<IEnumerable<IOptionsChangeTokenSource<HostFilteringOptions>>>()); 1765Assert.Single(app.Services.GetRequiredService<IEnumerable<IServer>>()); 1874var ds = app.Services.GetRequiredService<EndpointDataSource>(); 1934var ds = app.Services.GetRequiredService<EndpointDataSource>(); 1989var ds = app.Services.GetRequiredService<EndpointDataSource>(); 2229var hostEnv = app.Services.GetRequiredService<Hosting.IWebHostEnvironment>(); 2255var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 2256var webHostEnv = app.Services.GetRequiredService<IWebHostEnvironment>(); 2285var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 2286var webHostEnv = app.Services.GetRequiredService<IWebHostEnvironment>();
WebHostTests.cs (3)
38var config = host.Services.GetRequiredService<IConfiguration>(); 39var monitor = host.Services.GetRequiredService<IOptionsMonitor<HostFilteringOptions>>(); 105var logger = host.Services.GetRequiredService<ILogger<WebHostTests>>();
Microsoft.AspNetCore.WebSockets.Tests (1)
AddWebSocketsTests.cs (1)
25var socketOptions = services.GetRequiredService<IOptions<WebSocketOptions>>().Value;
Microsoft.DotNet.Helix.Sdk (6)
ProvisioningProfileProvider.cs (6)
245serviceProvider.GetRequiredService<TaskLoggingHelper>(), 246serviceProvider.GetRequiredService<IHelpers>(), 247serviceProvider.GetRequiredService<IFileSystem>(), 248serviceProvider.GetRequiredService<IZipArchiveManager>(), 249serviceProvider.GetRequiredService<HttpClient>(), 250serviceProvider.GetRequiredService<IRetryHandler>(),
Microsoft.Extensions.AmbientMetadata.Application.Tests (4)
AcceptanceTests.cs (2)
59await func(host.Services.GetRequiredService<IOptions<ApplicationMetadata>>().Value, 60host.Services.GetRequiredService<IHostEnvironment>());
ApplicationMetadataExtensionsTests.cs (2)
114var actualMetadata = provider.GetRequiredService<IOptions<ApplicationMetadata>>().Value; 140var actualMetadata = provider.GetRequiredService<IOptions<ApplicationMetadata>>().Value;
Microsoft.Extensions.AsyncState.Tests (2)
AsyncStateTests.cs (2)
258services.GetRequiredService<IAsyncState>().Initialize(); 259return services.GetRequiredService<IAsyncContext<T>>();
Microsoft.Extensions.Caching.Hybrid (1)
Internal\DefaultHybridCache.cs (1)
62_localCache = services.GetRequiredService<IMemoryCache>();
Microsoft.Extensions.Caching.Hybrid.Tests (20)
BufferReleaseTests.cs (1)
23cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>());
FunctionalTests.cs (1)
17cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>());
L2Tests.cs (1)
42cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>());
RedisTests.cs (2)
50var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>()); 68var redis = provider.GetRequiredService<IConnectionMultiplexer>();
SampleUsage.cs (4)
21var obj = provider.GetRequiredService<SomeDCService>(); 41var obj = provider.GetRequiredService<SomeHCService>(); 61var obj = provider.GetRequiredService<SomeHCServiceNoCapture>(); 81var obj = provider.GetRequiredService<SomeHCServiceNoCaptureObjReuse>();
ServiceConstructionTests.cs (8)
92var cache = provider.GetRequiredService<HybridCache>(); 105var cache = provider.GetRequiredService<HybridCache>(); 118var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>()); 132var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>()); 144var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>()); 167var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>()); 179var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>()); 202var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>());
SizeTests.cs (2)
21var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>()); 66var cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>());
StampedeTests.cs (1)
28cache = Assert.IsType<DefaultHybridCache>(provider.GetRequiredService<HybridCache>());
Microsoft.Extensions.Caching.MicroBenchmarks (2)
DistributedCacheBenchmarks.cs (2)
58sqlServer = (IBufferDistributedCache)services.BuildServiceProvider().GetRequiredService<IDistributedCache>(); 66redis = (IBufferDistributedCache)services.BuildServiceProvider().GetRequiredService<IDistributedCache>();
Microsoft.Extensions.Caching.SqlServer.Tests (1)
SqlServerCacheServicesExtensionsTest.cs (1)
52Assert.IsType<SqlServerCache>(serviceProvider.GetRequiredService<IDistributedCache>());
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (4)
CacheServiceExtensionsTests.cs (4)
49Assert.IsAssignableFrom<RedisCache>(serviceProvider.GetRequiredService<IDistributedCache>()); 71var distributedCache = serviceProvider.GetRequiredService<IDistributedCache>(); 88var distributedCache = serviceProvider.GetRequiredService<IDistributedCache>(); 120Assert.IsAssignableFrom<RedisCache>(serviceProvider.GetRequiredService<IDistributedCache>());
Microsoft.Extensions.Compliance.Redaction.Tests (7)
HmacRedactorExtensionsTests.cs (2)
21.GetRequiredService<IRedactorProvider>(); 38.GetRequiredService<IRedactorProvider>();
HmacRedactorTest.cs (2)
105.GetRequiredService<IRedactorProvider>(); 130.GetRequiredService<IRedactorProvider>();
RedactionAcceptanceTests.cs (2)
28var redactorProvider = services.GetRequiredService<IRedactorProvider>(); 69var redactorProvider = serviceProvider.GetRequiredService<IRedactorProvider>();
RedactorProviderTests.cs (1)
91.GetRequiredService<IRedactorProvider>();
Microsoft.Extensions.Compliance.Testing (5)
FakeRedactionServiceCollectionExtensions.cs (4)
31var collector = serviceProvider.GetRequiredService<FakeRedactionCollector>(); 32var options = serviceProvider.GetRequiredService<IOptions<FakeRedactorOptions>>().Value; 57var collector = serviceProvider.GetRequiredService<FakeRedactionCollector>(); 58var options = serviceProvider.GetRequiredService<IOptions<FakeRedactorOptions>>().Value;
FakeRedactionServiceProviderExtensions.cs (1)
26=> Throw.IfNull(serviceProvider).GetRequiredService<FakeRedactionCollector>();
Microsoft.Extensions.Compliance.Testing.Tests (11)
RedactionFakesAcceptanceTests.cs (11)
25var provider = services.GetRequiredService<IRedactorProvider>(); 44var provider = services.GetRequiredService<IRedactorProvider>(); 64var provider = services.GetRequiredService<IRedactorProvider>(); 83var provider = services.GetRequiredService<IRedactorProvider>(); 103var provider = services.GetRequiredService<IRedactorProvider>(); 123var provider = services.GetRequiredService<IRedactorProvider>(); 143var provider = services.GetRequiredService<IRedactorProvider>(); 163var provider = services.GetRequiredService<IRedactorProvider>(); 183var provider = services.GetRequiredService<IRedactorProvider>(); 204var provider = services.GetRequiredService<IRedactorProvider>(); 247var rp = sp.GetRequiredService<IRedactorProvider>();
Microsoft.Extensions.DependencyInjection.Abstractions (3)
ISupportRequiredService.cs (1)
9/// Optional contract used by <see cref="ServiceProviderServiceExtensions.GetRequiredService{T}(IServiceProvider)"/>
ServiceProviderServiceExtensions.cs (2)
78return provider.GetRequiredService<IEnumerable<T>>(); 104return provider.GetRequiredService<IServiceScopeFactory>().CreateScope();
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (5)
ApplicationLifecycleHealthChecksExtensionsTests.cs (1)
56var registrations = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value.Registrations;
ManualHealthCheckExtensionsTests.cs (1)
51var registrations = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value.Registrations;
TelemetryHealthChecksPublisherExtensionsTests.cs (3)
25var publishers = serviceProvider.GetRequiredService<IEnumerable<IHealthCheckPublisher>>(); 45var publishers = serviceProvider.GetRequiredService<IEnumerable<IHealthCheckPublisher>>(); 63var publishers = serviceProvider.GetRequiredService<IEnumerable<IHealthCheckPublisher>>();
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (13)
DefaultHealthCheckServiceTest.cs (4)
42var scopeFactory = services.GetRequiredService<IServiceScopeFactory>(); 43var options = services.GetRequiredService<IOptions<HealthCheckServiceOptions>>(); 44var logger = services.GetRequiredService<ILogger<DefaultHealthCheckService>>(); 638return (DefaultHealthCheckService)services.BuildServiceProvider(validateScopes: true).GetRequiredService<HealthCheckService>();
DependencyInjection\HealthChecksBuilderTest.cs (9)
32var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 52var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 75var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 97var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 123var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 146var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 169var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 192var options = serviceProvider.GetRequiredService<IOptions<HealthCheckServiceOptions>>().Value; 214var options = services.BuildServiceProvider().GetRequiredService<IOptions<HealthCheckServiceOptions>>();
Microsoft.Extensions.Diagnostics.Probes (1)
TcpEndpointProbesExtensions.cs (1)
51var options = provider.GetRequiredService<IOptionsMonitor<TcpEndpointProbesOptions>>().Get(name);
Microsoft.Extensions.Diagnostics.ResourceMonitoring (2)
ResourceMonitorBuilder.cs (2)
20services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, ResourceMonitorService>(static sp => sp.GetRequiredService<ResourceMonitorService>())); 21services.TryAddSingleton<IResourceMonitor>(static sp => sp.GetRequiredService<ResourceMonitorService>());
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (8)
Linux\AcceptanceTest.cs (5)
34var provider = services.GetRequiredService<ISnapshotProvider>(); 63var options = services.GetRequiredService<IOptions<ResourceMonitoringOptions>>(); 85var options = services.GetRequiredService<IOptions<ResourceMonitoringOptions>>(); 236meterScope = host.Services.GetRequiredService<IMeterFactory>(); 320meterScope = host.Services.GetRequiredService<IMeterFactory>();
ResourceMonitoringBuilderTests.cs (1)
24var publisher = provider.GetRequiredService<IResourceUtilizationPublisher>();
ResourceMonitoringExtensionsTests.cs (2)
44var trackerService = provider.GetRequiredService<IResourceMonitor>(); 60var trackerService = provider.GetRequiredService<IResourceMonitor>();
Microsoft.Extensions.Hosting (6)
HostBuilder.cs (6)
308services.AddSingleton(s => (IApplicationLifetime)s.GetRequiredService<IHostApplicationLifetime>()); 323appServices.GetRequiredService<IHostApplicationLifetime>(), 324appServices.GetRequiredService<ILogger<Internal.Host>>(), 325appServices.GetRequiredService<IHostLifetime>(), 326appServices.GetRequiredService<IOptions<HostOptions>>()); 377var host = serviceProvider.GetRequiredService<IHost>();
Microsoft.Extensions.Hosting.Abstractions (1)
HostingAbstractionsHostExtensions.cs (1)
92IHostApplicationLifetime applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>();
Microsoft.Extensions.Hosting.Testing.Tests (2)
FakeHostBuilderTests.cs (1)
31var options = hostBuilderServices.GetRequiredService<FakeHostOptions>();
HostingFakesExtensionsTests.cs (1)
321var logger = host.Services.GetRequiredService<ILogger>();
Microsoft.Extensions.Http (18)
DefaultHttpClientFactory.cs (2)
99() => _services.GetRequiredService<ILoggerFactory>().CreateLogger<DefaultHttpClientFactory>(), 145HttpMessageHandlerBuilder builder = services.GetRequiredService<HttpMessageHandlerBuilder>();
DependencyInjection\HttpClientBuilderExtensions.cs (8)
137options.HttpMessageHandlerBuilderActions.Add(b => b.AdditionalHandlers.Add(b.Services.GetRequiredService<THandler>())); 219options.HttpMessageHandlerBuilderActions.Add(b => b.PrimaryHandler = b.Services.GetRequiredService<THandler>()); 384IHttpClientFactory httpClientFactory = s.GetRequiredService<IHttpClientFactory>(); 387ITypedHttpClientFactory<TClient> typedClientFactory = s.GetRequiredService<ITypedHttpClientFactory<TClient>>(); 448IHttpClientFactory httpClientFactory = s.GetRequiredService<IHttpClientFactory>(); 451ITypedHttpClientFactory<TImplementation> typedClientFactory = s.GetRequiredService<ITypedHttpClientFactory<TImplementation>>(); 492IHttpClientFactory httpClientFactory = s.GetRequiredService<IHttpClientFactory>(); 541IHttpClientFactory httpClientFactory = s.GetRequiredService<IHttpClientFactory>();
DependencyInjection\HttpClientBuilderExtensions.Logging.cs (1)
113return AddLogger(builder, services => services.GetRequiredService<TLogger>(), wrapHandlersPipeline);
DependencyInjection\HttpClientFactoryServiceCollectionExtensions.cs (3)
41services.TryAddSingleton<IHttpClientFactory>(serviceProvider => serviceProvider.GetRequiredService<DefaultHttpClientFactory>()); 42services.TryAddSingleton<IHttpMessageHandlerFactory>(serviceProvider => serviceProvider.GetRequiredService<DefaultHttpClientFactory>()); 68return s.GetRequiredService<IHttpClientFactory>().CreateClient(string.Empty);
DependencyInjection\HttpClientKeyedLifetime.cs (3)
66return serviceProvider.GetRequiredService<IHttpClientFactory>().CreateClient(name); 75HttpMessageHandler handler = serviceProvider.GetRequiredService<IHttpMessageHandlerFactory>().CreateHandler(name); 82HttpClientMappingRegistry registry = serviceProvider.GetRequiredService<HttpClientMappingRegistry>();
Logging\LoggingHttpMessageHandlerBuilderFilter.cs (1)
19private ILoggerFactory LoggerFactory => _loggerFactory ??= _serviceProvider.GetRequiredService<ILoggerFactory>();
Microsoft.Extensions.Http.Diagnostics (2)
Latency\HttpClientLatencyTelemetryExtensions.cs (1)
44var handler = httpMessageHandlerBuilder.Services.GetRequiredService<HttpLatencyTelemetryHandler>();
Logging\Internal\ServiceProviderExtensions.cs (1)
23? provider.GetRequiredService<T>()
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (8)
HttpClientFactory.cs (8)
34.GetRequiredService<IHttpClientFactory>() 57.GetRequiredService<IHttpClientFactory>() 84.GetRequiredService<IHttpClientFactory>() 107.GetRequiredService<IHttpClientFactory>() 130.GetRequiredService<IHttpClientFactory>() 157.GetRequiredService<IHttpClientFactory>() 168.GetRequiredService<IHttpClientFactory>() 178.GetRequiredService<IHttpClientFactory>()
Microsoft.Extensions.Http.Diagnostics.Tests (66)
Latency\HttpClientLatencyTelemetryExtensionsTest.cs (7)
42var listener = sp.GetRequiredService<HttpRequestLatencyListener>(); 45var latencyContext = sp.GetRequiredService<HttpClientLatencyContext>(); 49var options = sp.GetRequiredService<IOptions<HttpClientLatencyTelemetryOptions>>().Value; 53var handler = sp.GetRequiredService<HttpLatencyTelemetryHandler>(); 66using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 83var options = sp.GetRequiredService<IOptions<HttpClientLatencyTelemetryOptions>>().Value; 103var options = sp.GetRequiredService<IOptions<HttpClientLatencyTelemetryOptions>>().Value;
Logging\AcceptanceTests.cs (25)
39using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 70using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 106using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient("testClient"); 159using var namedClient1 = provider.GetRequiredService<IHttpClientFactory>().CreateClient("namedClient1"); 160using var namedClient2 = provider.GetRequiredService<IHttpClientFactory>().CreateClient("namedClient2"); 307using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 314var requestContext = sp.GetRequiredService<IOutgoingRequestContext>(); 354using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 419using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 426var requestContext = sp.GetRequiredService<IOutgoingRequestContext>(); 465var factory = provider.GetRequiredService<IHttpClientFactory>(); 471var optionsFirst = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(FirstClientName); 472var optionsSecond = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(SecondClientName); 506var optionsFirst = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(nameof(ITestHttpClient1)); 507var optionsSecond = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(nameof(ITestHttpClient2)); 556var optionsFirst = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(nameof(ITestHttpClient1)); 557var optionsSecond = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(nameof(ITestHttpClient2)); 558var optionsThird = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get("testClient3"); 559var optionsFourth = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get("testClient4"); 560var optionsFifth = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get("testClient5"); 561var optionsSixth = provider.GetRequiredService<IOptions<LoggingOptions>>().Value; 590var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 616var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("normal"); 639var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 676.GetRequiredService<IHttpClientFactory>()
Logging\HttpClientLoggingExtensionsTest.cs (13)
93var optionsFirst = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get("test1"); 94var optionsSecond = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get("test2"); 116var optionsFirst = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(nameof(ITestHttpClient1)); 117var optionsSecond = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get(nameof(ITestHttpClient2)); 139var options = provider.GetRequiredService<IOptions<LoggingOptions>>().Value; 178var options = provider.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get("test"); 235.GetRequiredService<IOptionsMonitor<LoggingOptions>>().Get("test"); 288var options = provider.GetRequiredService<IOptions<LoggingOptions>>().Value; 307using var httpClient = provider.GetRequiredService<IHttpClientFactory>().CreateClient(); 326.GetRequiredService<IHostedService>() 385.GetRequiredService<IOptions<LoggingOptions>>().Value; 390using var httpClient = provider.GetRequiredService<IHttpClientFactory>().CreateClient(); 403using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient();
Logging\HttpRequestReaderTest.cs (16)
77var reader = new HttpRequestReader(serviceProvider, options.ToOptionsMonitor(serviceKey), serviceProvider.GetRequiredService<IHttpRouteFormatter>(), 78serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext, serviceKey: serviceKey); 140var reader = new HttpRequestReader(serviceProvider, options.ToOptionsMonitor(), serviceProvider.GetRequiredService<IHttpRouteFormatter>(), 141serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext); 204serviceProvider.GetRequiredService<IHttpRouteFormatter>(), serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext); 279serviceProvider.GetRequiredService<IHttpRouteFormatter>(), serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext); 351serviceProvider.GetRequiredService<IHttpRouteFormatter>(), serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext); 409serviceProvider.GetRequiredService<IHttpRouteFormatter>(), serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext); 480serviceProvider.GetRequiredService<IHttpRouteFormatter>(), serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext); 547serviceProvider.GetRequiredService<IHttpRouteFormatter>(), serviceProvider.GetRequiredService<IHttpRouteParser>(), RequestMetadataContext);
Logging\Internal\HelperExtensions.cs (1)
21builder.AdditionalHandlers.Add(builder.Services.GetRequiredService<NoRemoteCallHandler>());
Telemetry\DownstreamDependencyMetadataManagerTests.cs (1)
23_depMetadataManager = _sp.GetRequiredService<IDownstreamDependencyMetadataManager>();
TelemetryCommonExtensionsTests.cs (3)
42Assert.NotNull(sp.GetRequiredService<IHttpRouteParser>()); 43Assert.NotNull(sp.GetRequiredService<IHttpRouteFormatter>()); 57Assert.NotNull(sp.GetRequiredService<IHttpHeadersRedactor>());
Microsoft.Extensions.Http.Polly (6)
DependencyInjection\PollyHttpClientBuilderExtensions.cs (3)
142var registry = services.GetRequiredService<IReadOnlyPolicyRegistry<string>>(); 181var registry = services.GetRequiredService<IReadOnlyPolicyRegistry<string>>(); 273var registry = services.GetRequiredService<IPolicyRegistry<string>>();
DependencyInjection\PollyServiceCollectionExtensions.cs (3)
112services.AddSingleton<IConcurrentPolicyRegistry<string>>(serviceProvider => serviceProvider.GetRequiredService<PolicyRegistry>()); 113services.AddSingleton<IPolicyRegistry<string>>(serviceProvider => serviceProvider.GetRequiredService<PolicyRegistry>()); 114services.AddSingleton<IReadOnlyPolicyRegistry<string>>(serviceProvider => serviceProvider.GetRequiredService<PolicyRegistry>());
Microsoft.Extensions.Http.Polly.Tests (10)
DependencyInjection\PollyHttpClientBuilderExtensionsTest.cs (10)
52var factory = services.GetRequiredService<IHttpClientFactory>(); 87var factory = services.GetRequiredService<IHttpClientFactory>(); 125var factory = services.GetRequiredService<IHttpClientFactory>(); 166var factory = services.GetRequiredService<IHttpClientFactory>(); 210var factory = services.GetRequiredService<IHttpClientFactory>(); 263var factory = services.GetRequiredService<IHttpClientFactory>(); 308var factory = services.GetRequiredService<IHttpClientFactory>(); 352var factory = services.GetRequiredService<IHttpClientFactory>(); 408string policyName = serviceProvider.GetRequiredService<PollyPolicyOptions>().PolicyName; 422var factory = services.GetRequiredService<IHttpClientFactory>();
Microsoft.Extensions.Http.Resilience (8)
Resilience\Internal\PipelineKeyProviderHelper.cs (1)
28return provider.GetRequiredService<IOptionsMonitor<PipelineKeyOptions>>().Get(pipelineName).KeyProvider;
Resilience\ResilienceHttpClientBuilderExtensions.Resilience.cs (2)
70var provider = serviceProvider.GetRequiredService<ResiliencePipelineProvider<HttpKey>>(); 80var resilienceProvider = serviceProvider.GetRequiredService<ResiliencePipelineProvider<HttpKey>>();
Resilience\ResilienceHttpClientBuilderExtensions.StandardResilience.cs (1)
79var monitor = context.ServiceProvider.GetRequiredService<IOptionsMonitor<HttpStandardResilienceOptions>>();
Routing\RoutingStrategyBuilderExtensions.cs (4)
130var optionsCache = new NamedOptionsCache<OrderedGroupsRoutingOptions>(builder.Name, serviceProvider.GetRequiredService<IOptionsMonitor<OrderedGroupsRoutingOptions>>()); 131var factory = new OrderedGroupsRoutingStrategyFactory(serviceProvider.GetRequiredService<Randomizer>(), optionsCache); 142var optionsCache = new NamedOptionsCache<WeightedGroupsRoutingOptions>(builder.Name, serviceProvider.GetRequiredService<IOptionsMonitor<WeightedGroupsRoutingOptions>>()); 143var factory = new WeightedGroupsRoutingStrategyFactory(serviceProvider.GetRequiredService<Randomizer>(), optionsCache);
Microsoft.Extensions.Http.Resilience.PerformanceTests (4)
HedgingBenchmark.cs (1)
24var factory = serviceProvider.GetRequiredService<IHttpClientFactory>();
HttpResilienceBenchmark.cs (1)
37var factory = serviceProvider.GetRequiredService<IHttpClientFactory>();
RetryBenchmark.cs (1)
62var factory = services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>();
StandardResilienceBenchmark.cs (1)
64var factory = services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>();
Microsoft.Extensions.Http.Resilience.Tests (21)
Hedging\HedgingTests.cs (1)
345return _serviceProvider.GetRequiredService<IHttpClientFactory>().CreateClient(ClientId);
Hedging\StandardHedgingTests.cs (7)
66var options = serviceProvider.GetRequiredService<IOptionsMonitor<HttpStandardHedgingResilienceOptions>>().Get(Builder.Name); 81var options = serviceProvider.GetRequiredService<IOptionsMonitor<HttpStandardHedgingResilienceOptions>>().Get(Builder.Name); 103var options = serviceProvider.GetRequiredService<IOptionsMonitor<HttpStandardHedgingResilienceOptions>>().Get(Builder.Name); 112var options = serviceProvider.GetRequiredService<IOptionsMonitor<HttpStandardHedgingResilienceOptions>>().Get(Builder.Name); 143.GetRequiredService<IOptionsMonitor<HttpStandardHedgingResilienceOptions>>() 174var pipelineProvider = serviceProvider.GetRequiredService<ResiliencePipelineProvider<HttpKey>>(); 336var clientFactory = provider.GetRequiredService<IHttpClientFactory>();
Resilience\GrpcResilienceTests.cs (1)
108return services.BuildServiceProvider().GetRequiredService<Greeter.GreeterClient>();
Resilience\HttpClientBuilderExtensionsTests.Resilience.cs (7)
79var client = serviceProvider.GetRequiredService<IHttpClientFactory>().CreateClient("client"); 132var client = clientBuilder.Services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>().CreateClient("client"); 174var registryOptions = serviceProvider.GetRequiredService<IOptions<ResiliencePipelineRegistryOptions<HttpKey>>>().Value; 229var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("client"); 264var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("client"); 265var pipelineProvider = provider.GetRequiredService<ResiliencePipelineProvider<HttpKey>>(); 284var factory = serviceProvider.GetRequiredService<IHttpClientFactory>();
Resilience\HttpClientBuilderExtensionsTests.Standard.cs (4)
60return _serviceProvider.GetRequiredService<IHttpClientFactory>().CreateClient(name); 163var provider = serviceProvider.GetRequiredService<ResiliencePipelineProvider<HttpKey>>(); 266using var client = builder.Services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>().CreateClient("test"); 297var provider = services.BuildServiceProvider().GetRequiredService<ResiliencePipelineProvider<HttpKey>>();
Routing\RoutingStrategyTest.cs (1)
154.GetRequiredService<IOptionsMonitor<RequestRoutingOptions>>()
Microsoft.Extensions.Identity.Core (2)
UserManager.cs (2)
608var keyRing = _services.GetRequiredService<ILookupProtectorKeyRing>(); 609var protector = _services.GetRequiredService<ILookupProtector>();
Microsoft.Extensions.Logging (1)
LoggerFactory.cs (1)
116ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
Microsoft.Extensions.ML (1)
PoolLoader.cs (1)
27var contextOptions = sp.GetRequiredService<IOptions<MLOptions>>();
Microsoft.Extensions.ML.Tests (2)
FileLoaderTests.cs (1)
51var context = sp.GetRequiredService<IOptions<MLOptions>>().Value.MLContext;
PredictionEnginePoolTests.cs (1)
38var pool = sp.GetRequiredService<PredictionEnginePool<SentimentData, SentimentPrediction>>();
Microsoft.Extensions.ObjectPool.DependencyInjection.Tests (21)
DependencyInjectionExtensionsTests.cs (21)
54var sut = provider.GetRequiredService<IOptionsMonitor<DependencyInjectionPoolOptions>>(); 69var options = provider.GetRequiredService<IOptionsMonitor<DependencyInjectionPoolOptions>>(); 104var pool = provider.GetRequiredService<ObjectPool<ITestClass>>(); 119var optionsMonitor = provider.GetRequiredService<IOptionsMonitor<DependencyInjectionPoolOptions>>(); 148var optionsMonitor = provider.GetRequiredService<IOptionsMonitor<DependencyInjectionPoolOptions>>(); 163var pool = provider.GetRequiredService<ObjectPool<ITestClass>>(); 182var pool = provider.GetRequiredService<ObjectPool<ITestClass>>(); 217Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<ObjectPool<ITestClass>>().Get()); 227.AddScoped<ITestClass>(provider => provider.GetRequiredService<Pooled<TestClass>>().Object) 240resolved1 = scope.ServiceProvider.GetRequiredService<ITestClass>(); 241resolved2 = scope.ServiceProvider.GetRequiredService<ITestClass>(); 262.AddTransient<ITestClass>(provider => provider.GetRequiredService<Pooled<TestClass>>().Object) 273resolved1 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 274resolved2 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 277resolved3 = scope2.ServiceProvider.GetRequiredService<ITestClass>(); 278resolved4 = scope2.ServiceProvider.GetRequiredService<ITestClass>(); 319.AddScoped<ITestClass>(provider => provider.GetRequiredService<Pooled<TestClass>>().Object) 330resolved1 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 331resolved2 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 334resolved3 = scope2.ServiceProvider.GetRequiredService<ITestClass>(); 335resolved4 = scope2.ServiceProvider.GetRequiredService<ITestClass>();
Microsoft.Extensions.Options (45)
OptionsBuilder.cs (45)
71new ConfigureNamedOptions<TOptions, TDep>(Name, sp.GetRequiredService<TDep>(), configureOptions)); 92new ConfigureNamedOptions<TOptions, TDep1, TDep2>(Name, sp.GetRequiredService<TDep1>(), sp.GetRequiredService<TDep2>(), configureOptions)); 117sp.GetRequiredService<TDep1>(), 118sp.GetRequiredService<TDep2>(), 119sp.GetRequiredService<TDep3>(), 147sp.GetRequiredService<TDep1>(), 148sp.GetRequiredService<TDep2>(), 149sp.GetRequiredService<TDep3>(), 150sp.GetRequiredService<TDep4>(), 180sp.GetRequiredService<TDep1>(), 181sp.GetRequiredService<TDep2>(), 182sp.GetRequiredService<TDep3>(), 183sp.GetRequiredService<TDep4>(), 184sp.GetRequiredService<TDep5>(), 220new PostConfigureOptions<TOptions, TDep>(Name, sp.GetRequiredService<TDep>(), configureOptions)); 241new PostConfigureOptions<TOptions, TDep1, TDep2>(Name, sp.GetRequiredService<TDep1>(), sp.GetRequiredService<TDep2>(), configureOptions)); 266sp.GetRequiredService<TDep1>(), 267sp.GetRequiredService<TDep2>(), 268sp.GetRequiredService<TDep3>(), 296sp.GetRequiredService<TDep1>(), 297sp.GetRequiredService<TDep2>(), 298sp.GetRequiredService<TDep3>(), 299sp.GetRequiredService<TDep4>(), 329sp.GetRequiredService<TDep1>(), 330sp.GetRequiredService<TDep2>(), 331sp.GetRequiredService<TDep3>(), 332sp.GetRequiredService<TDep4>(), 333sp.GetRequiredService<TDep5>(), 381new ValidateOptions<TOptions, TDep>(Name, sp.GetRequiredService<TDep>(), validation, failureMessage)); 413sp.GetRequiredService<TDep1>(), 414sp.GetRequiredService<TDep2>(), 452sp.GetRequiredService<TDep1>(), 453sp.GetRequiredService<TDep2>(), 454sp.GetRequiredService<TDep3>(), 496sp.GetRequiredService<TDep1>(), 497sp.GetRequiredService<TDep2>(), 498sp.GetRequiredService<TDep3>(), 499sp.GetRequiredService<TDep4>(), 545sp.GetRequiredService<TDep1>(), 546sp.GetRequiredService<TDep2>(), 547sp.GetRequiredService<TDep3>(), 548sp.GetRequiredService<TDep4>(), 549sp.GetRequiredService<TDep5>(),
Microsoft.Extensions.Options.ConfigurationExtensions (1)
OptionsBuilderConfigurationExtensions.cs (1)
83return new ConfigurationChangeTokenSource<TOptions>(optionsBuilder.Name, sp.GetRequiredService<IConfiguration>());
Microsoft.Extensions.Options.Contextual.Tests (8)
AcceptanceTests.cs (1)
94.GetRequiredService<IWeatherForecastService>();
ContextualOptionsServiceCollectionExtensionsTests.cs (7)
24Assert.IsType<ContextualOptions<object, WeatherForecastContext>>(provider.GetRequiredService<IContextualOptions<object, WeatherForecastContext>>()); 25Assert.IsType<ContextualOptions<object, WeatherForecastContext>>(provider.GetRequiredService<INamedContextualOptions<object, WeatherForecastContext>>()); 26Assert.IsType<ContextualOptionsFactory<object>>(provider.GetRequiredService<IContextualOptionsFactory<object>>()); 36var loader = (LoadContextualOptions<string>)provider.GetRequiredService<ILoadContextualOptions<string>>(); 46var loader = (LoadContextualOptions<string>)provider.GetRequiredService<ILoadContextualOptions<string>>(); 58var loader = (LoadContextualOptions<string>)provider.GetRequiredService<ILoadContextualOptions<string>>(); 68var loader = (LoadContextualOptions<string>)provider.GetRequiredService<ILoadContextualOptions<string>>();
Microsoft.Extensions.Resilience.PerformanceTests (1)
ResilienceEnrichmentBenchmark.cs (1)
47return services.BuildServiceProvider().GetRequiredService<ResiliencePipelineProvider<string>>().GetPipeline("my-pipeline");
Microsoft.Extensions.Resilience.Tests (2)
Resilience\ResilienceServiceCollectionExtensionsTests.cs (2)
38var enrichers = _services.BuildServiceProvider().GetRequiredService<IOptions<TelemetryOptions>>().Value.MeteringEnrichers; 48var enrichers = services.BuildServiceProvider().GetRequiredService<IOptions<TelemetryOptions>>().Value.MeteringEnrichers;
Microsoft.Extensions.ServiceDiscovery (2)
ServiceDiscoveryServiceCollectionExtensions.cs (2)
68services.TryAddSingleton(sp => new ServiceEndpointResolver(sp.GetRequiredService<ServiceEndpointWatcherFactory>(), sp.GetRequiredService<TimeProvider>()));
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
DnsServiceEndpointResolverTests.cs (1)
22var resolver = services.GetRequiredService<ServiceEndpointResolver>();
DnsSrvServiceEndpointResolverTests.cs (2)
107var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 194var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>();
Microsoft.Extensions.ServiceDiscovery.Tests (18)
ConfigurationServiceEndpointResolverTests.cs (7)
32var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 73var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 157var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 249var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 291var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 358var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 403var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>();
PassThroughServiceEndpointResolverTests.cs (4)
27var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 58var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 91var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 126var resolver = services.GetRequiredService<ServiceEndpointResolver>();
ServiceEndpointResolverTests.cs (7)
28var resolverFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 52var resolverFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 62var client = services.GetRequiredService<IHttpClientFactory>().CreateClient("foo"); 106var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 158var resolver = services.GetRequiredService<ServiceEndpointResolver>(); 194var resolverProvider = services.GetRequiredService<ServiceEndpointWatcherFactory>(); 239var watcherFactory = services.GetRequiredService<ServiceEndpointWatcherFactory>();
Microsoft.Extensions.ServiceDiscovery.Yarp.Tests (2)
YarpServiceDiscoveryTests.cs (2)
23var coreResolver = serviceProvider.GetRequiredService<ServiceEndpointResolver>(); 26serviceProvider.GetRequiredService<IOptions<ServiceDiscoveryOptions>>());
Microsoft.Extensions.Telemetry.Abstractions.Tests (9)
Latency\NoopLatencyContextTests.cs (9)
26var latencyContextProvider = serviceProvider.GetRequiredService<ILatencyContextProvider>(); 42Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 43scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 44Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 45scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>()); 48Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 49scope2.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 50Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 51scope2.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>());
Microsoft.Extensions.Telemetry.PerformanceTests (1)
ExtendedLoggerBench.cs (1)
76return serviceCollection.BuildServiceProvider().GetRequiredService<ILoggerFactory>().CreateLogger("Benchmark");
Microsoft.Extensions.Telemetry.Tests (46)
Enrichment\ApplicationEnricherExtensionsTests.cs (5)
42Assert.NotNull(host.Services.GetRequiredService<IStaticLogEnricher>()); 61Assert.NotNull(host.Services.GetRequiredService<IStaticLogEnricher>()); 62var options = host.Services.GetRequiredService<IOptions<ApplicationLogEnricherOptions>>().Value; 85var enricher = host.Services.GetRequiredService<IStaticLogEnricher>(); 88var options = host.Services.GetRequiredService<IOptions<ApplicationLogEnricherOptions>>().Value;
Enrichment\ProcessEnricherExtensionsTests.cs (5)
45Assert.NotNull(host.Services.GetRequiredService<ILogEnricher>()); 62Assert.NotNull(host.Services.GetRequiredService<ILogEnricher>()); 63var options = host.Services.GetRequiredService<IOptions<ProcessLogEnricherOptions>>().Value; 83var enricher = host.Services.GetRequiredService<ILogEnricher>(); 86var options = host.Services.GetRequiredService<IOptions<ProcessLogEnricherOptions>>().Value;
Http\HttpParserTests.cs (2)
468var httpRouteParser = sp.GetRequiredService<IHttpRouteParser>(); 469var httpRouteFormatter = sp.GetRequiredService<IHttpRouteFormatter>();
Http\TelemetryCommonExtensionsTests.cs (2)
40Assert.NotNull(sp.GetRequiredService<IHttpRouteParser>()); 41Assert.NotNull(sp.GetRequiredService<IHttpRouteFormatter>());
Latency\Internal\LatencyContextTests.cs (15)
83var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 84var tokenIssuer = services.GetRequiredService<ILatencyContextTokenIssuer>(); 110var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 111var tokenIssuer = services.GetRequiredService<ILatencyContextTokenIssuer>(); 136var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 137var tokenIssuer = services.GetRequiredService<ILatencyContextTokenIssuer>(); 164var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 165var tokenIssuer = services.GetRequiredService<ILatencyContextTokenIssuer>(); 194var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 195var tokenIssuer = services.GetRequiredService<ILatencyContextTokenIssuer>(); 220var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 245var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 246var tokenIssuer = services.GetRequiredService<ILatencyContextTokenIssuer>(); 271var context = services.GetRequiredService<ILatencyContextProvider>().CreateContext(); 272var tokenIssuer = services.GetRequiredService<ILatencyContextTokenIssuer>();
Latency\LatencyConsoleExtensionsTests.cs (3)
32var exporter = serviceProvider.GetRequiredService<ILatencyDataExporter>(); 45var exporter = serviceProvider.GetRequiredService<ILatencyDataExporter>(); 62var actualOptions = provider.GetRequiredService<IOptions<LatencyConsoleOptions>>();
Latency\LatencyContextExtensionTests.cs (13)
31var latencyContextProvider = serviceProvider.GetRequiredService<ILatencyContextProvider>(); 35var latencyContextTokenIssuer = serviceProvider.GetRequiredService<ILatencyContextTokenIssuer>(); 51Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 52scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 53Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 54scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>()); 57Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 58scope2.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 59Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 60scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>()); 74var latencyContextProvider = serviceProvider.GetRequiredService<ILatencyContextProvider>(); 78var latencyContextTokenIssuer = serviceProvider.GetRequiredService<ILatencyContextTokenIssuer>(); 98var actualOptions = provider.GetRequiredService<IOptions<LatencyContextOptions>>();
Logging\Utils.cs (1)
23ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
Microsoft.Extensions.WebEncoders.Tests (15)
EncoderServiceCollectionExtensionsTests.cs (15)
24Assert.Same(HtmlEncoder.Default, serviceProvider.GetRequiredService<HtmlEncoder>()); // default encoder 25Assert.Same(HtmlEncoder.Default, serviceProvider.GetRequiredService<HtmlEncoder>()); // as singleton instance 26Assert.Same(JavaScriptEncoder.Default, serviceProvider.GetRequiredService<JavaScriptEncoder>()); // default encoder 27Assert.Same(JavaScriptEncoder.Default, serviceProvider.GetRequiredService<JavaScriptEncoder>()); // as singleton instance 28Assert.Same(UrlEncoder.Default, serviceProvider.GetRequiredService<UrlEncoder>()); // default encoder 29Assert.Same(UrlEncoder.Default, serviceProvider.GetRequiredService<UrlEncoder>()); // as singleton instance 48var htmlEncoder = serviceProvider.GetRequiredService<HtmlEncoder>(); 50Assert.Same(htmlEncoder, serviceProvider.GetRequiredService<HtmlEncoder>()); // as singleton instance 52var javaScriptEncoder = serviceProvider.GetRequiredService<JavaScriptEncoder>(); 54Assert.Same(javaScriptEncoder, serviceProvider.GetRequiredService<JavaScriptEncoder>()); // as singleton instance 56var urlEncoder = serviceProvider.GetRequiredService<UrlEncoder>(); 58Assert.Same(urlEncoder, serviceProvider.GetRequiredService<UrlEncoder>()); // as singleton instance 80var htmlEncoder = serviceProvider.GetRequiredService<HtmlEncoder>(); 83var javaScriptEncoder = serviceProvider.GetRequiredService<JavaScriptEncoder>(); 86var urlEncoder = serviceProvider.GetRequiredService<UrlEncoder>();
Microsoft.Gen.Logging.Generated.Tests (1)
Utils.cs (1)
91var logger = serviceProvider.GetRequiredService<ILoggerFactory>().CreateLogger(nameof(Utils));
Microsoft.ML.AutoML (16)
API\AutoMLExperimentExtension.cs (9)
164var settings = service.GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>(); 230var channel = service.GetRequiredService<IChannel>(); 231var settings = service.GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>(); 232var context = service.GetRequiredService<MLContext>(); 250var settings = service.GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>(); 269var settings = service.GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>(); 288var settings = service.GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>(); 314var channel = serviceProvider.GetRequiredService<IChannel>(); 315var settings = serviceProvider.GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>();
AutoMLExperiment\AutoMLExperiment.cs (7)
63var contextManager = provider.GetRequiredService<IMLContextManager>(); 82var channel = provider.GetRequiredService<IChannel>(); 97var channel = provider.GetRequiredService<IChannel>(); 219var logger = serviceProvider.GetRequiredService<IChannel>(); 232var logger = serviceProvider.GetRequiredService<IChannel>(); 233var aggregateTrainingStopManager = serviceProvider.GetRequiredService<AggregateTrainingStopManager>(); 263using (var runner = serviceProvider.GetRequiredService<ITrialRunner>())
Microsoft.ML.AutoML.Tests (2)
AutoMLExperimentTests.cs (2)
420var settings = experiment.ServiceCollection.BuildServiceProvider().GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>(); 425settings = experiment.ServiceCollection.BuildServiceProvider().GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>();
Microsoft.ML.Fairlearn (6)
AutoML\AutoMLExperimentExtension.cs (4)
75var context = serviceProvider.GetRequiredService<MLContext>(); 76var moment = serviceProvider.GetRequiredService<ClassificationMoment>(); 77var datasetManager = serviceProvider.GetRequiredService<TrainValidateDatasetManager>(); 78var pipeline = serviceProvider.GetRequiredService<SweepablePipeline>();
AutoML\TunerFactory.cs (2)
31_pipeline = provider.GetRequiredService<SweepablePipeline>(); 33var settings = provider.GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>();
Microsoft.ML.GenAI.Phi.Tests (1)
SemanticKernelTests.cs (1)
41var chatService = kernel.Services.GetRequiredService<IChatCompletionService>();
Mvc.RoutingWebSite (1)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
57var urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
OrderProcessor (1)
OrderProcessingWorker.cs (1)
31_messageConnection = _serviceProvider.GetRequiredService<IConnection>();
RoutingSandbox (4)
Framework\FrameworkEndpointRouteBuilderExtensions.cs (1)
13var dataSource = endpoints.ServiceProvider.GetRequiredService<FrameworkEndpointDataSource>();
UseEndpointRoutingStartup.cs (3)
35var dataSource = httpContext.RequestServices.GetRequiredService<EndpointDataSource>(); 70var graphWriter = httpContext.RequestServices.GetRequiredService<DfaGraphWriter>(); 71var dataSource = httpContext.RequestServices.GetRequiredService<EndpointDataSource>();
RoutingWebSite (3)
UseEndpointRoutingStartup.cs (3)
41var dataSource = httpContext.RequestServices.GetRequiredService<EndpointDataSource>(); 98var linkGenerator = httpContext.RequestServices.GetRequiredService<LinkGenerator>(); 110var linkGenerator = httpContext.RequestServices.GetRequiredService<LinkGenerator>();
SecurityWebSite (1)
Controllers\AdministrationController.cs (1)
25var countEvaluator = (CountingPolicyEvaluator)HttpContext.RequestServices.GetRequiredService<IPolicyEvaluator>();
Shared.Tests (3)
Debugger\DebuggerTest.cs (3)
27var debugger = provider.GetRequiredService<IDebuggerState>(); 40var debugger = provider.GetRequiredService<IDebuggerState>(); 53var debugger = provider.GetRequiredService<IDebuggerState>();
SocialSample (5)
Startup.cs (5)
263var schemeProvider = context.RequestServices.GetRequiredService<IAuthenticationSchemeProvider>(); 472return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<GoogleOptions>>().Get(currentAuthType)); 476return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<MicrosoftAccountOptions>>().Get(currentAuthType)); 480return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<FacebookOptions>>().Get(currentAuthType)); 484return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<OAuthOptions>>().Get(currentAuthType));
SocialWeather (1)
Startup.cs (1)
38var formatterResolver = app.ApplicationServices.GetRequiredService<FormatterResolver>();
Sockets.BindTests (5)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
102return new KestrelServerImpl(sp.GetServices<IConnectionListenerFactory>(), Array.Empty<IMultiplexedConnectionListenerFactory>(), sp.GetRequiredService<IHttpsConfigurationService>(), context);
src\Servers\Kestrel\test\BindTests\AddressRegistrationTests.cs (3)
632var serverAddresses = host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses; 677var serverAddresses = host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses; 717var serverAddresses = host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses;
Sockets.FunctionalTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IHostPortExtensions.cs (1)
30return host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
102return new KestrelServerImpl(sp.GetServices<IConnectionListenerFactory>(), Array.Empty<IMultiplexedConnectionListenerFactory>(), sp.GetRequiredService<IHttpsConfigurationService>(), context);
SqlServerEndToEnd.DbSetup (2)
Program.cs (2)
12using var db1 = scope.ServiceProvider.GetRequiredService<MyDb1Context>(); 13using var db2 = scope.ServiceProvider.GetRequiredService<MyDb2Context>();
StartRequestDelegateUrlApp (1)
Program.cs (1)
23var env = context.RequestServices.GetRequiredService<IHostEnvironment>();
StartRouteBuilderUrlApp (1)
Program.cs (1)
24var env = req.HttpContext.RequestServices.GetRequiredService<IHostEnvironment>();
StartWithIApplicationBuilderUrlApp (1)
Program.cs (1)
26var env = context.RequestServices.GetRequiredService<IHostEnvironment>();
Stress.ApiService (1)
Program.cs (1)
27_ = app.Services.GetRequiredService<TestMetrics>();
Stress.AppHost (1)
ResourceBuilderExtensions.cs (1)
62var httpClient = context.ServiceProvider.GetRequiredService<IHttpClientFactory>().CreateClient();
VersioningWebSite (1)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
57var urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
WaitForSandbox.DbSetup (1)
Program.cs (1)
10using var db = scope.ServiceProvider.GetRequiredService<MyDbContext>();
Wasm.Performance.ConsoleHost (1)
Scenarios\ComponentRenderingScenarioBase.cs (1)
30var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
Wasm.Performance.Driver (1)
Program.cs (1)
328return testApp.Services.GetRequiredService<IServer>()
XmlFormattersWebSite (2)
Controllers\XmlDataContractApiController.cs (1)
26var mvcOptions = context.HttpContext.RequestServices.GetRequiredService<IOptions<MvcOptions>>();
Controllers\XmlSerializedApiController.cs (1)
26var mvcOptions = context.HttpContext.RequestServices.GetRequiredService<IOptions<MvcOptions>>();