Skip to content

debug: invalid 'null' entries in DAP 'variables' response #199

Closed
@puremourning

Description

@puremourning

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.14.2 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • reproduced with
Version: 1.45.1
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
Date: 2020-05-14T08:33:47.663Z (3 wks ago)
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.4.0
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.14.4
  • Run go env to get the go development environment details
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ben/Library/Caches/go-build"
GOENV="/Users/ben/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ben/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14.2_1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.2_1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/fo
lders/s3/v5q17n8532x05nn495s125yh0000gn/T/go-build110363984=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

I have not changed any settings from their defaults.

Describe the bug

When requesting the DAP variables request, the server returns nulll for some entries in the response, which is invalid.

Steps to reproduce the behavior:

  • Create the following file:
package main

func main() {
	a := 0
	b := 1
	c := 2
	d := map[string]int{
		"0": 0,
		"1": 1,
		"2": 2,
	}
	print(a, b, c, d)
}
  • Use the following launch.json:
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "${file}",
      "env": {},
      "args": [],
      "trace": "verbose"
    }
  ]
}
  • Set a breakpoint on the print
  • Start debugging
  • Observe the following invalid message in the console
VariablesResponse [
 {
  "name": "\"0\"",
  "value": "0",
  "evaluateName": "d[\"0\"]",
  "variablesReference": 0
 },
 null,
 {
  "name": "\"1\"",
  "value": "1",
  "evaluateName": "d[\"1\"]",
  "variablesReference": 0
 },
 null,
 {
  "name": "\"2\"",
  "value": "2",
  "evaluateName": "d[\"2\"]",
  "variablesReference": 0
 },
 null
]

(Note the null values). This causes compliant DAP implementations to raise errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DebugIssues related to the debugging functionality of the extension.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions