Skip to content

Evaluating a record with recursive reference results in termination of the program with Stack Overflow #48646

@tmat

Description

@tmat

Version Used:
Version 16.9.0 Preview 1.0 [30614.203.main]

Steps to Reproduce:

Place breakpoint as indicated, F5 and open Locals Window, then step (F10).

record C
{
    public int X { get; init; }
    public int Y { get; init; }
    public int Z { get; init; }

    public C Inner { get; set; }
}

class Program
{
    static void Main(string[] args)
    {
        var c = new C();
        c.Inner = c; // breakpoint here
    }
}

Actual Behavior:

image

Expected Behavior:

SO is prevented.

Perhaps the implementation should only go to certain depth and then bail.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions