Home

Pointers in LINQPad should dump to actually value instead of System.Reflection.Pointer

edited August 2020

Say this code in LINQPad5/LINQPad6:

unsafe void Main()
{
    var t = new Test();
    t.Dump();

    int v = 3;
    t.D = &v;
    t.Dump();
}

unsafe struct Test
{
    public int* D;
}

Will Generate following Dumped result(System.Reflection.Pointer):

If I really want to know what's the actual value, I need to dump this field manually:

I think LINQPad should try doing following things to make it better:
1. Trying to display null when pointer is null
2. Trying to display the actual value when pointer is not null.
3. (optional) Have a special mark to identifier this is a dumped pointer value instead of a normal class property

Maybe something like this:

Comments

Sign In or Register to comment.