dotnet/runtime · error · Exception

ctf_sequence needs to have its memory expilicitly laid out

Error message

ctf_sequence needs to have its memory expilicitly laid out

What it means

Raised by generateFieldList() in genLttngProvider.py when a template parameter's winType maps to ctf_sequence in ctfDataTypeMapping but the parameter has no 'prop' (property) set. The ctf_sequence CTF macro requires explicit memory layout information (the sequence length/element-size variable), which is normally provided via the count property. Without it, the generator cannot produce valid LTTng tracepoint field code.

Source

Thrown at src/coreclr/scripts/genLttngProvider.py:213

            ctf_type    = None
            varname     = fnparam.name

            if fnparam.prop:
                #this is an explicit struct treat as a sequence
                ctf_type = "ctf_sequence"
                sizeofseq = fnparam.prop
                field_body = ", ".join((typewName, varname, varname, "size_t", sizeofseq))

            else:
                ctf_type = ctfDataTypeMapping[wintypeName]
                if ctf_type == "ctf_string":
                    field_body = ", ".join((varname, varname))

                elif ctf_type == "ctf_integer" or ctf_type == "ctf_float":
                    field_body = ", ".join((typewName, varname, varname))

                elif ctf_type == "ctf_sequence":
                    raise Exception("ctf_sequence needs to have its memory expilicitly laid out")

                else:
                    raise Exception("no such ctf intrinsic called: " +  ctf_type)

            field_list.append("        %s(%s)" % (ctf_type, field_body))

        field_list = "\n".join(field_list)

    return header + field_list + footer

def generateLttngHeader(providerName, allTemplates, eventNodes, runtimeFlavor):
    lTTngHdr = []
    for templateName in allTemplates:
        template = allTemplates[templateName]
        fnSig   = allTemplates[templateName].signature

        lTTngHdr.append("\n#define " + templateName + "_TRACEPOINT_ARGS \\\n")

View on GitHub (pinned to 60108ba66e)

Solutions

  1. Add a 'count' attribute to the <data> element in the manifest referencing the variable that holds the sequence length.
  2. Ensure the data element has the proper struct/array annotation so fnparam.prop is set during parseTemplateNodes().
  3. If using win:GUID, verify the code path in parseTemplateNodes sets var_Props for GUID types (it does set sizeof(GUID)/sizeof(int)).
  4. Use a different inType that doesn't map to ctf_sequence if the data doesn't need sequence semantics.

Example fix

<!-- before: GUID without count/struct layout -->
<data name="MyGuid" inType="win:GUID" />

<!-- after: the parseTemplateNodes code sets prop for win:GUID automatically,
     so if this fires, the issue may be a win:Binary without count -->
<data name="RawData" inType="win:Binary" count="DataLen" />
<data name="DataLen" inType="win:UInt32" />
Defensive patterns

Strategy: validation

Validate before calling

# Types that map to ctf_sequence and need explicit prop
SEQUENCE_TYPES_REQUIRING_PROP = {'win:GUID', 'win:Binary', 'win:Struct', 'win:count'}

def validate_template_for_lttng(template_nodes) -> list:
    """Check that ctf_sequence-mapped types have the necessary prop/count attribute."""
    from genEventing import parseTemplateNodes, getPalDataTypeMapping
    from genLttngProvider import ctfDataTypeMapping

    issues = []
    templates = parseTemplateNodes(template_nodes)
    for tid, template in templates.items():
        for param_name in template.signature.paramlist:
            fnparam = template.signature.getParam(param_name)
            if fnparam.winType in SEQUENCE_TYPES_REQUIRING_PROP:
                if not fnparam.prop:
                    issues.append(
                        f"Template '{tid}', param '{param_name}' ({fnparam.winType}): "
                        f"needs explicit count/struct layout for LTTng ctf_sequence")
    return issues

Type guard

null

Try / catch

try:
    generateLttngHeader(providerName, allTemplates, eventNodes, runtimeFlavor)
except Exception as e:
    if 'ctf_sequence' in str(e):
        print(f"LTTng generation failed: {e}")
        print("Add a 'count' attribute referencing the length variable for the sequence data element.")
    raise

Prevention

When it happens

Trigger: Triggered when: (a) fnparam.prop is falsy (None or empty), so the code enters the else branch, (b) ctfDataTypeMapping[wintypeName] returns 'ctf_sequence', and (c) the code reaches the 'ctf_sequence' branch which immediately raises. Types that map to ctf_sequence are: win:count, win:Struct, win:GUID, and win:Binary. For win:GUID and win:Binary without a prop, this error fires because the generator expects explicit struct/sequence layout via the prop field.

Common situations: A template data element uses win:GUID or win:Binary without a count attribute, so FunctionParameter assigns count='win:null' and prop remains None. The manifest was previously handled by ETW (mc.exe) but the LTTng generator requires additional annotations. A type that needs sequence layout in LTTng doesn't have the necessary count/length specification in the manifest.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/55a5d2f2ed386066. Report an issue: GitHub.