-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
area-Extensions-DependencyInjectionbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
In 3.0 we rewrote the code generation logic in the DI container to make it resillent to stack overflows for deep object graphs. As a result of this change, what would previously result in a stackoverflow exception for lazily resolved circular references now results in an infinite recursion. We're missing a number of stacks maximum. a deadlock.
using System;
using Microsoft.Extensions.DependencyInjection;
namespace WebApplication315
{
public class Program
{
public static void Main(string[] args)
{
var services = new ServiceCollection();
services.AddSingleton<Foo>();
var serviceProvider = services.BuildServiceProvider();
var foo = serviceProvider.GetService<Foo>();
}
}
public class Foo
{
public Foo(IServiceProvider serviceProvider)
{
serviceProvider.GetService<Foo>();
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-Extensions-DependencyInjectionbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors