According to StructureMap documentation and examples from StructureMap.Microsoft.DependencyInjection repository it has to work but it doesn't.
Here is my Startup class:
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddTransient<IMovieRepository, MovieRepository>();
var container = new Container();
container.Configure(config =>
{
config.AddRegistry(new MyRegistry());
config.Populate(services);
});
return container.GetInstance<IServiceProvider>();
}
And Registry:
public class MyRegistry : Registry
{
public MyRegistry()
{
For<IMovieRepository>().Transient().Use<MovieRepository>();
}
}
And here is error screenshot:
What's wrong with my code?

using StructureMap;to the top of the code file so you can call the Populate exension method?