Trying to resolve a concrete type with dependencies does not work when I pass the IServiceProvicer in as an argument to the Invoke-method. However, if I get the service via Container first, and then try to resolve with IServiceProvider it works:
public async Task Invoke(HttpContext context, IServiceProvider serviceProvider)
{
var myService1 = serviceProvider.GetService(typeof(MyService)); // == null
var myService2 = Startup.Container.GetInstance<MyService>(); // != null
var myService2 = serviceProvider.GetService(typeof(MyService)); // != null
...
EDIT: This is for .NET Core 2.0.