perfview icon indicating copy to clipboard operation
perfview copied to clipboard

ulong event property is displayed as long in event viewer.

Open tomuxmon opened this issue 2 months ago • 3 comments

I have a method to write ulong event in my event source:

    [NonEvent]
    private unsafe void WriteEvent(int eventId, ulong arg1)
    {
        if (IsEnabled())
        {
            EventData* descrs = stackalloc EventData[1];
            descrs[0] = new EventData { DataPointer = (IntPtr)(&arg1), Size = 8 };
            WriteEventCore(eventId, 1, descrs);
        }
    }

Yet it is still displayed as a long value inside the events grid view.

Image

Is this expected behavior or fixable?

tomuxmon avatar Oct 08 '25 08:10 tomuxmon

I am not surprised at this. Looking at the code - at a minimum, this is coming from the PayloadFetch struct, which converts incoming signed and unsigned types into their signed .NET equivalents.

I am not sure how easy this is to fix, but I would hope relatively simple. Let's start with copilot trying to update PayloadFetch to differentiate between signed and unsigned types and see if that solves the problem.

Copilot: Please focus specifically on changing the handling of UInt16, UInt32, and UInt64. Don't touch UInt8. You should be able to update the switch statement to set the .NET type to be the unsigned type that matches the input type, rather than translating to the signed .NET type.

brianrob avatar Oct 08 '25 19:10 brianrob

@tomuxmon would you mind testing #2315 and see if that fixes your issue?

brianrob avatar Oct 13 '25 21:10 brianrob

@tomuxmon would you mind testing https://github.com/microsoft/perfview/pull/2315 and see if that fixes your issue?

brianrob avatar Nov 06 '25 20:11 brianrob