Skip to content

dotnet-pgo: SPGO fails with perfcollect LTTng traces — missing MethodDetails CTF mapping in TraceEvent #125883

Description

@benaadams

Description

dotnet-pgo create-mibc --spgo fails when processing perfcollect .trace.zip files on Linux due to multiple missing CTF event mappings and a serialization issue in TraceEvent.

Issues Found

1. Missing MethodDetails CTF mapping

ClrTraceEventParser.EnumerateCtfEventMappings() doesn't include DotNETRuntime:MethodDetails (opcode 43, event ID 72). dotnet-pgo fails with "No MethodDetails".

2. Missing MethodILToNativeMap_V1 CTF mapping

The runtime fires MethodILToNativeMap_V1 but only MethodILToNativeMap (v0) has a CTF mapping. SPGO reports "Samples in managed code without native<->IL mappings" for all managed samples.

3. TraceLog drops ThreadID=0 events

CreateFromLinuxEventSources passes default TraceLogOptions where KeepAllEvents=false. CopyRawEvents drops events with ThreadID=0 when KeepAllEvents is false. LTTng CLR events from perfcollect have ThreadID=0, so MethodILToNativeMap events are silently dropped during .etlx serialization.

4. perfcollect missing tracepoints

perfcollect's default event set doesn't include TypeKeyword (BulkType), JittedMethodILToNativeMapKeyword (MethodILToNativeMap), and the LoaderKeyword array has a duplicate declaration that loses AssemblyLoad.

Fix

PerfView PR: microsoft/perfview#2392

Adds missing CTF mappings:

yield return new CtfEventMapping("DotNETRuntime:MethodDetails", 
    Parsers.ClrTraceEventParser.ProviderGuid, 43, 72, 0);
yield return new CtfEventMapping("DotNETRuntime:MethodILToNativeMap_V1",
    Parsers.ClrTraceEventParser.ProviderGuid, 87, 190, 0);

Note: MethodILToNativeMap_V1 uses version: 0 in the CTF mapping because TraceLog's template lookup is version-sensitive and only version 0 templates are registered.

The KeepAllEvents and perfcollect issues are separate fixes needed in TraceLog and perfcollect respectively.

After the PerfView fix ships as a new TraceEvent NuGet, dotnet-pgo should bump its TraceEventVersion.

Impact

This blocks SPGO on Linux when using perfcollect. The EventPipe .nettrace path works fine.

Workaround

Build TraceEvent from PerfView source with the fix applied. Use KeepAllEvents=true when calling CreateFromLinuxEventSources. Patch perfcollect to add missing tracepoints.

Activity

  1. lateralusX commented on Jul 20, 2026

    @lateralusX
    Member

    Runtime issue tracks bumping the trace event library for runtime (dotnet-pgo). TraceEvent is mainly used by runtime tools/tests, not in the shipping product. @benaadams, do you think the perfview PR will land so it could make it into .net11 or should this be put on future?

  2. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 20, 2026
  3. added this to the 11.0.0 milestone on Jul 20, 2026
  4. added
    blockedIssue/PR is blocked on something - see comments
    on Jul 31, 2026
  5. modified the milestones: 11.0.0, 12.0.0 on Jul 31, 2026
  6. mdh1418 commented on Jul 31, 2026

    @mdh1418
    Member

    If TraceEvent gets a release containing the fix, we can bump it ASAP, but until then we are blocked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions