dotnet/runtime · error · Exception

{}:No ClrInstanceID field of type win:UInt16 for event symbo

Error message

{}:No ClrInstanceID field of type win:UInt16 for event symbol {}

What it means

Raised by checkConsistency() in genEtwProvider.py during manifest validation. For events that have stack-walk enabled (clrInstanceBit is True) and have a template, the script checks that the template contains a field named 'ClrInstanceID' of type 'win:UInt16'. If this field is missing or has the wrong type, the exception fires with the event symbol name.

Source

Thrown at src/coreclr/scripts/genEtwProvider.py:123

        templateNodes         = providerNode.getElementsByTagName('template')
        eventProvider         = providerNode.getAttribute('name')
        allTemplates          = parseTemplateNodes(templateNodes)

        for eventNode in eventNodes:
            taskName         = eventNode.getAttribute('task')
            eventSymbol      = eventNode.getAttribute('symbol')
            eventTemplate    = eventNode.getAttribute('template')
            eventValue       = int(eventNode.getAttribute('value'))
            clrInstanceBit   = getStackWalkBit(eventProvider, taskName, eventSymbol, exclusionInfo.noclrinstance)
            sLookupFieldName = "ClrInstanceID"
            sLookupFieldType = "win:UInt16"

            if clrInstanceBit and allTemplates.get(eventTemplate):
                # check for the event template and look for a field named ClrInstanceId of type win:UInt16
                fnParam = allTemplates[eventTemplate].getFnParam(sLookupFieldName)

                if not(fnParam and fnParam.winType == sLookupFieldType):
                    raise Exception(exclusion_filename + ":No " + sLookupFieldName + " field of type " + sLookupFieldType + " for event symbol " +  eventSymbol)

            # If some versions of an event are on the nostack/stack lists,
            # and some versions are not on either the nostack or stack list,
            # then developer likely forgot to specify one of the versions

            eventStackBitFromNoStackList       = getStackWalkBit(eventProvider, taskName, eventSymbol, exclusionInfo.nostack)
            eventStackBitFromExplicitStackList = getStackWalkBit(eventProvider, taskName, eventSymbol, exclusionInfo.explicitstack)
            sStackSpecificityError = exclusion_filename + ": Error processing event :" + eventSymbol + "(ID" + str(eventValue) + "): This file must contain either ALL versions of this event or NO versions of this event. Currently some, but not all, versions of this event are present\n"

            if not stackSupportSpecified.get(eventValue):
                 # Haven't checked this event before.  Remember whether a preference is stated
                if ( not eventStackBitFromNoStackList) or ( not eventStackBitFromExplicitStackList):
                    stackSupportSpecified[eventValue] = True
                else:
                    stackSupportSpecified[eventValue] = False
            else:
                # We've checked this event before.
                if stackSupportSpecified[eventValue]:

View on GitHub (pinned to 60108ba66e)

Solutions

  1. Add a '<data name="ClrInstanceID" inType="win:UInt16" />' field to the event's template in the .man manifest file.
  2. If the event should not carry a ClrInstanceID, add its provider:task:symbol to the noclrinstance section of the exclusion list file (--exc argument).
  3. Verify the exclusion list file path is correct and the parseExclusionList function is reading it properly.
  4. Check for typos in the event symbol name in the exclusion list.

Example fix

<!-- before: template missing ClrInstanceID -->
<template tid="t:MyEvent">
  <data name="Count" inType="win:UInt32" />
</template>

<!-- after: add ClrInstanceID field -->
<template tid="t:MyEvent">
  <data name="Count" inType="win:UInt32" />
  <data name="ClrInstanceID" inType="win:UInt16" />
</template>
Defensive patterns

Strategy: validation

Validate before calling

def validate_clr_instance_id(manifest_path: str, exclusion_path: str) -> bool:
    """Pre-check that all stack-walking events have ClrInstanceID in their template."""
    import xml.dom.minidom as DOM
    from genEventing import parseTemplateNodes
    from utilities import parseExclusionList

    tree = DOM.parse(manifest_path)
    exclusion_info = parseExclusionList(exclusion_path)

    for provider_node in tree.getElementsByTagName('provider'):
        event_provider = provider_node.getAttribute('name')
        templates = parseTemplateNodes(provider_node.getElementsByTagName('template'))
        for event_node in provider_node.getElementsByTagName('event'):
            task = event_node.getAttribute('task')
            symbol = event_node.getAttribute('symbol')
            template = event_node.getAttribute('template')
            # Check if event needs ClrInstanceID (not in noclrinstance list)
            needs_clr_instance = True
            for entry in exclusion_info.noclrinstance:
                tokens = entry.split(':')
                if (tokens[0] in (event_provider, '*') and
                    tokens[1] in (task, '*') and
                    tokens[2] in (symbol, '*')):
                    needs_clr_instance = False
                    break
            if needs_clr_instance and template in templates:
                param = templates[template].getFnParam('ClrInstanceID')
                if not (param and param.winType == 'win:UInt16'):
                    print(f"MISSING ClrInstanceID for event {symbol}")
                    return False
    return True

Type guard

null

Try / catch

try:
    checkConsistency(manifest, exclusion_filename)
except Exception as e:
    if 'ClrInstanceID' in str(e):
        print(f"Manifest validation failed: {e}")
        print("Add ClrInstanceID field to the template or add event to noclrinstance list.")
    raise

Prevention

When it happens

Trigger: Triggered when: (a) the event is not in the exclusion list's noclrinstance set (so clrInstanceBit is True), (b) the event has a template that exists in allTemplates, and (c) allTemplates[eventTemplate].getFnParam('ClrInstanceID') returns None or its winType is not 'win:UInt16'. This is a manifest correctness check ensuring every stack-walking event carries the ClrInstanceID correlation field.

Common situations: A developer adds a new ETW event to ClrEtwAll.man with a template that enables stack collection but forgets to include the ClrInstanceID field. An existing event's template is modified and the ClrInstanceID field is accidentally removed or its type changed. The event symbol is added to the noclrinstance exclusion list but the list file path is wrong, so the exclusion isn't applied.

Related errors


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