ServiceProvider not providing registered service [Answered]

For some reason, despite registering this api wrapper as so:
services.TryAddScoped<IInContactRestAPI>
(
    serviceProvider => new InContactRestAPI
    (
        serviceProvider.GetRequiredService<IRestHttpClient>(),
        serviceProvider.GetRequiredService<IOptionsMonitor<JsonSerializerOptions>>().Get(InContact),
        serviceProvider.GetRequiredService<IOptions<InContactConfig>>(),
        serviceProvider.GetRequiredService<ITokenStore>()
    )
);

Attempting to retrieve it from the service provider results in an InvalidOperationException because the type is not in the service provider. This happens whether I request the interface or the concrete implementation. Rider does in fact confirm that the scoped rest api wrapper is present in the service collection when stepping through.
unknown.png
unknown.png
Was this page helpful?