Skip to content

Conversation

@rcjsuen
Copy link
Contributor

@rcjsuen rcjsuen commented Oct 23, 2025

The setBreakpoints response body is defined to be an array of breakpoints but the debug adapter incorrectly serialized an empty array as null in the JSON message. Explicitly initializing the array will force the JSON serialization process to send an empty array back instead of null.

Edit: This fixes #3480.

Before:

{
    "command": "setBreakpoints",
    "arguments": {
        "source": {
            "name": "Dockerfile",
            "path": "/tmp/buildx-debugging-demo/Dockerfile"
        },
        "lines": [],
        "breakpoints": [],
        "sourceModified": false
    },
    "type": "request",
    "seq": 12
}
{
    "seq": 32,
    "type": "response",
    "request_seq": 12,
    "success": true,
    "command": "setBreakpoints",
    "body": {
        "breakpoints": null
    }
}

After:

{
    "command": "setBreakpoints",
    "arguments": {
        "source": {
            "name": "Dockerfile",
            "path": "/tmp/buildx-debugging-demo/Dockerfile"
        },
        "lines": [],
        "breakpoints": [],
        "sourceModified": false
    },
    "type": "request",
    "seq": 12
}
{
    "seq": 35,
    "type": "response",
    "request_seq": 12,
    "success": true,
    "command": "setBreakpoints",
    "body": {
        "breakpoints": []
    }
}

The setBreakpoints response body is defined to be an array of
breakpoints but the debug adapter incorrectly serialized an empty array
as null in the JSON message. Explicitly initializing the array will
force the JSON serialization process to send an empty array back instead
of null.

Signed-off-by: Remy Suen <remy.suen@docker.com>
Signed-off-by: Remy Suen <remy.suen@docker.com>
@rcjsuen rcjsuen requested a review from jsternberg October 23, 2025 14:44
@rcjsuen
Copy link
Contributor Author

rcjsuen commented Oct 23, 2025

The test failure is the TestLaunch one from #3479.

=== Failed
=== FAIL: dap TestLaunch (10.01s)
    adapter_test.go:176: [client] send: {"seq":1,"type":"request","command":"initialize","arguments":{"adapterID":"","linesStartAt1":false,"columnsStartAt1":false}}
    adapter_test.go:193: [server] recv: {"seq":1,"type":"request","command":"initialize","arguments":{"adapterID":"","linesStartAt1":false,"columnsStartAt1":false,"pathFormat":"path"}}
    adapter_test.go:176: [server] send: {"seq":1,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true}}
    adapter_test.go:193: [client] recv: {"seq":1,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true}}
    adapter_test.go:176: [client] send: {"seq":2,"type":"request","command":"launch","arguments":null}
    adapter_test.go:193: [server] recv: {"seq":2,"type":"request","command":"launch","arguments":null}
    adapter_test.go:176: [server] send: {"seq":2,"type":"event","event":"initialized"}
    adapter_test.go:176: [server] send: {"seq":3,"type":"response","request_seq":2,"success":true,"command":"launch"}
    adapter_test.go:193: [client] recv: {"seq":2,"type":"event","event":"initialized"}
    adapter_test.go:193: [client] recv: {"seq":3,"type":"response","request_seq":2,"success":true,"command":"launch"}
    adapter_test.go:176: [client] send: {"seq":3,"type":"request","command":"configurationDone"}
    adapter_test.go:193: [server] recv: {"seq":3,"type":"request","command":"configurationDone"}
    adapter_test.go:176: [server] send: {"seq":4,"type":"response","request_seq":3,"success":true,"command":"configurationDone"}
    adapter_test.go:193: [client] recv: {"seq":4,"type":"response","request_seq":3,"success":true,"command":"configurationDone"}
    adapter_test.go:65: 
        	Error Trace:	/home/runner/work/buildx/buildx/dap/adapter_test.go:65
        	            				/home/runner/work/buildx/buildx/vendor/golang.org/x/sync/errgroup/errgroup.go:93
        	            				/opt/hostedtoolcache/go/1.25.3/x64/src/runtime/asm_amd64.s:1693
        	Error:      	did not receive configurationDone response
        	Test:       	TestLaunch
    adapter_test.go:188: [client] recv error: context canceled
    adapter_test.go:176: [server] send: {"seq":5,"type":"event","event":"terminated","body":{}}
    adapter_test.go:188: [server] recv error: context canceled

@jsternberg jsternberg merged commit 166ab97 into docker:master Oct 24, 2025
201 of 202 checks passed
@rcjsuen rcjsuen deleted the dap-set-breakpoints-null-fix branch October 24, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setBreakpoints DAP response does not conform to the specification

2 participants