Skip to content

!clrstack reports incorrect method names when <> is encountered #4314

@leculver

Description

@leculver

When !clrstack encounters Program.<Main>(System.String[]), it trims the method name to: Program.(System.String[]). Both ClrMD and WinDbg (ICorDebug + IMetaDataReader) correctly return Program.<Main>(System.String[]).

I verified this with the main branch. I think the issue is that ClrStackImpl::PrintThread does not DML escape the MethodNameFromIP string we pass to TableOutput. It's not clear whether we should be specifically escaping in PrintThread or if TableOutput should do that.

To repro, create a .Net 8 app (preview), and add this code, and debug the resulting crash dump (or any async Main):

DivideData data = new()
{
    Numerator = 16,
    Denominator = 0,
};

Console.WriteLine($"{data.Numerator}/{data.Denominator} = {await DivideAsync(data)}");

static async Task<int> DivideAsync(DivideData divData)
{
    await Task.Delay(1000);

    return divData.Numerator / divData.Denominator;
}

class DivideData
{
    public int Numerator { get; set; }
    public int Denominator { get; set; }
}

(I'm working on other stuff at the moment, can't take this issue in the next two weeks. I was going to submit a quick fix, but there's not a globally defined DmlEscape.)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsos

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions