Skip to content

Parameter name stripping breaks debugger #102873

@MichalStrehovsky

Description

@MichalStrehovsky

We've been weary of doing optimizations that might affect debuggability, such as stripping unused properties. On the other hand, we strip parameter names. The following program:

class Program
{
    static void Main()
    {
        Test(null, null, null);
    }

    static void Test(string a, string b, string c)
    {
        string d = a;
        KeepLocal(ref d);
    }

    static void KeepLocal<T>(ref T t) { }
}

Looks like this under debugger:

image

We should probably decide whether we're fine breaking debugger and either stop doing this optimization unless DebuggerSupport is false, or open floodgates to more optimizations like this.

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzersin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

Status

High Priority

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions