using Microsoft.Extensions.Configuration;
namespace ClassLibrary7;
public class Class1
{
public static void Bind(IConfiguration config)
{
var supported = new ExampleSettings();
config.Bind(supported);
}
}
public record ExampleSettings
{
/// <summary>
/// A recursive data structure
/// </summary>
public TreeElement? Tree { get; set; }
}
/// <summary>
/// Represents a free-format data structure.
/// </summary>
public sealed class TreeElement : Dictionary<string, TreeElement>;
Expected results
I'd expect the code to compile successfully.
Actual results
This results in a StackOverflowException in the Configuration Binder source generator. When this happens, it locks VS up and you need to force kill it (or let it eventually crash).
Original Description
Can you open an issue (and a PR if you'd like) in https://github.com/dotnet/runtime to get this included in the "real" source generator? As you noted, this is a copy of the runtime code.
Repro steps
Expected results
I'd expect the code to compile successfully.
Actual results
This results in a StackOverflowException in the Configuration Binder source generator. When this happens, it locks VS up and you need to force kill it (or let it eventually crash).
Original Description
_Originally posted by @eerhardt in https://github.com/dotnet/aspire/pull/4441#discussion_r1648262424_