Skip to content

Self/this is not known in debugging (unless called "this") #12019

@dsyme

Description

@dsyme

For a member

    member aaa.M() = 

the aaa is the "this" or "self" value, always accessed via the "arg 0" parameter. However, this means the name aaa is not accessible in debugging, because the .NET debuggers always give "arg 0" the name "this" for methods.

I've noticed this about a million times but never fixed it.

We can solve this adequately in debug code by emitting a local value called aaa containing a copy of "arg 0"

Test code:

type C() =
    let x = 1
    member aaa.P = x + 1
    member aaa.M() = 
        let yyy = 1
        aaa.P + yyy // hover over "aaa" or "aaa.P"

let c = C()
c.M()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Debugstepping, debug points, stacks and moreBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.Ready

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions