{"record":{"id":"ae3335a0426b34c4","repo":"dotnet/runtime","slug":"don-t-know-size-for","errorCode":null,"errorMessage":"Don't know size for {}","messagePattern":"Don't know size for (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/genEventing.py","lineNumber":244,"sourceCode":"            total += 2\n        elif param == \"win:UInt8\":\n            total += 1\n        elif param == \"win:Pointer\":\n            if estimate:\n                total += 8\n            else:\n                pointers += 1\n        elif param == \"win:Binary\":\n            total += 1\n        elif estimate:\n            if param == \"win:AnsiString\":\n                total += 32\n            elif param == \"win:UnicodeString\":\n                total += 64\n            elif param == \"win:Struct\":\n                total += 32\n        else:\n            raise Exception(\"Don't know size for \" + param)\n\n    if estimate:\n        return total\n\n    return total, pointers\n\n\nclass Template:\n    def __repr__(self):\n        return \"<Template \" + self.name + \">\"\n\n    def __init__(self, templateName, fnPrototypes, dependencies, structSizes, arrays):\n        self.name = templateName\n        self.signature = FunctionSignature()\n        self.structs = structSizes\n        self.arrays = arrays\n\n        for variable in fnPrototypes.paramlist:","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/genEventing.py#L226-L262","documentation":"Raised by getParamSequenceSize() in genEventing.py when computing the exact (non-estimated) byte size of a template's parameter sequence. The function has explicit size mappings for known ETW types (win:Int64=8, win:UInt32=4, etc.). When estimate=False and the parameter type doesn't match any known type, and isn't a string/struct being estimated, the exception fires.","triggerScenarios":"Triggered when getParamSequenceSize is called with estimate=False (exact size mode) and encounters a parameter whose winType is not in the hardcoded list of known types. The known types are: win:Int64, win:ULong, GUID, win:Double, win:Int32, win:Boolean, win:UInt64, win:UInt32, win:UInt16, win:UInt8, win:Pointer, win:Binary (and win:AnsiString/win:UnicodeString/win:Struct only when estimate=True). This function is called from Template.estimated_size property with estimate=True, so the error would come from another caller using estimate=False.","commonSituations":"A new ETW input type is added to the manifest that isn't in the size mapping. The manifest uses a custom or non-standard inType value. A typo in the inType attribute produces an unrecognized type string.","solutions":["Check the ETW manifest for the data element with the unrecognized inType and fix any typos.","Add the missing type and its byte size to the if/elif chain in getParamSequenceSize().","Ensure the type is a standard ETW input type (win:Int8, win:HexInt32, etc. may need adding)."],"exampleFix":"# before\nelif param == \"win:Binary\":\n    total += 1\nelif estimate:\n    ...\nelse:\n    raise Exception(\"Don't know size for \" + param)\n\n# after - add missing type\nelif param == \"win:Binary\":\n    total += 1\nelif param == \"win:HexInt32\":\n    total += 4\nelif param == \"win:Int8\":\n    total += 1\nelif estimate:\n    ...\nelse:\n    raise Exception(\"Don't know size for \" + param)","handlingStrategy":"validation","validationCode":"KNOWN_EXACT_SIZES = {\n    'win:Int64': 8, 'win:ULong': 4, 'GUID': 16, 'win:Double': 8,\n    'win:Int32': 4, 'win:Boolean': 4, 'win:UInt64': 8, 'win:UInt32': 4,\n    'win:UInt16': 2, 'win:UInt8': 1, 'win:Pointer': 8, 'win:Binary': 1,\n}\n\ndef can_compute_exact_size(param_types) -> bool:\n    \"\"\"Check if all parameter types have known exact sizes.\"\"\"\n    return all(t in KNOWN_EXACT_SIZES for t in param_types)","typeGuard":"null","tryCatchPattern":"try:\n    total = getParamSequenceSize(params, estimate=False)\nexcept Exception as e:\n    if \"Don't know size\" in str(e):\n        # Fall back to estimated size for unknown types\n        total = getParamSequenceSize(params, estimate=True)\n        logging.warning(f\"Using estimated size due to unknown type: {e}\")\n    else:\n        raise","preventionTips":["Validate all inType values in the manifest against the known type list before generation.","Add new ETW types to getParamSequenceSize() when extending the manifest schema.","Run a dry-run validation pass over templates before full code generation.","Keep the type-size mapping in sync with the ETW type system."],"tags":["etw","manifest","eventing","coreclr","type-mapping"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}