Skip to content

Items of an object with custom enumerator are not listed by the debugger #325

@Lexikos

Description

@Lexikos

If an object has an __Enum property which refers to a built-in (native) method, the debugger engine calls the enumerator automatically and includes the items directly as child properties of the object. Built-in enumerators all support the following pattern described in the documentation, and are assumed safe to execute automatically:

If NumberOfVars is 2, the enumerator is expected to assign the key or index of an item to the first parameter and the value to the second parameter. Each key or index should be accepted as a parameter of the __Item property. This enables DBGp-based debuggers to get or set a specific item after listing them by invoking the enumerator.

If the method is instead user-defined, the debugger engine outputs the <enum> property to allow the client or user to choose whether to execute the enumerator. Without any special handling, SciTE4AutoHotkey and DebugVars.ahk are able to use this to display the items of an object with custom enumerator.

However, as noted in #133, vscode-autohotkey-debug filters out the <enum> property.

getting its value through the debugger will cause errors in subsequent communication with the debugger.

Other clients handle it without problem. dbgp_console.ahk can be used to verify that the response is valid and susequent commands work.

The engine currently does not suppress exceptions thrown by the enumerator (it should), but this does not appear to cause any issues with debugger communication. Once the error dialog is dismissed, the debugger engine ends enumeration and completes the response as if there were no further items.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions