Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'value' of undefined" when closing multiple terminals started by launch.json + F5 #52737

Closed
Strum355 opened this issue Jun 23, 2018 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues

Comments

@Strum355
Copy link

Strum355 commented Jun 23, 2018

  • VSCode Version: 1.24.1
  • OS Version: Linux Mint 18.3 Kernel 4.13.0-43

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Have a launch.json, tasks.json and package.json with the content as seen in Ex3
  2. Run Launch Client in the debug menu. Two terminals are opened, one for watch:server and one for watch:client, as well as the new VSCode window
  3. Press Ctrl+C and Enter in the first terminal opened to close the watcher and subsequently the terminal
  4. Press Ctrl+C in the second terminal opened. The focus then changes to the Output tab, Ex2 is shown, and Ex1 is seen in the developer tools

Notes:
If I open vscode extension host client multiple times, it naturally spawns 2*n terminals, as there are 2 watchers. Only every second terminal closed seems to cause the issue aka if I have 4 open, only the 2nd and 4th terminal closed will cause the issue, the order they were started in is irrelevant.

Ex1:

image

Ex2:

image

Ex3:

launch.json	
{  
	"type": "extensionHost",  
	"request": "launch",  
	"name": "Launch Client",  
	"runtimeExecutable": "${execPath}",  
	"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],  
	"stopOnEntry": false,  
	"sourceMaps": true,  
	"outFiles": ["${workspaceRoot}/client/out/**/*.js"],  
	"preLaunchTask": "watch"  
}  

tasks.json
{
    "type": "npm",
    "script": "watch:client",
    "isBackground": true,
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "shared"
    },
    "problemMatcher": [
        "$tsc-watch"
    ]
},
{
    "type": "npm",
    "script": "watch:server",
    "isBackground": true,
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "shared"
    },
    "problemMatcher": [
        "$tsc-watch"
    ]
},
{
    "label": "watch",
    "isBackground": true,
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "shared"
    },
    "dependsOn": [
        "npm: watch:server",
        "npm: watch:client"
    ]
}

package.json
"scripts" : {
    "watch:client": "tsc -w -p ./client/tsconfig.json",
	"watch:server": "tsc -w -p ./server/tsconfig.json",
}
@ghost
Copy link

ghost commented Jul 10, 2018

Also seeing this issue using 1.25.0 on Windows 10.

In my case, I am seeing this using the following tasks.json when pressing Ctrl+Shift+B to trigger the default build task.

{
    "version": "2.0.0",
    "tasks": [
        {
            "identifier": "build:debug:anycpu",
            "label": "Build (Debug - Any CPU)",
            "group": "build",
            "type": "shell",
            "windows": {
                "command": "xbuild"
            },
            "linux": {
                "command": "msbuild"
            },
            "args": [
                "/p:Configuration=Debug",
                "/p:Platform='Any CPU'",
                "Sharpcraft.sln"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        },
        {
            "identifier": "build:debug:x86",
            "label": "Build (Debug - x86)",
            "group": "build",
            "type": "shell",
            "windows": {
                "command": "xbuild"
            },
            "linux": {
                "command": "msbuild"
            },
            "args": [
                "/p:Configuration=Debug",
                "/p:Platform=x86",
                "Sharpcraft.sln"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        },
        {
            "identifier": "build:debug:x64",
            "label": "Build (Debug - x64)",
            "group": "build",
            "type": "shell",
            "windows": {
                "command": "xbuild"
            },
            "linux": {
                "command": "msbuild"
            },
            "args": [
                "/p:Configuration=Debug",
                "/p:Platform=x64",
                "Sharpcraft.sln"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        },
        {
            "identifier": "build:release:anycpu",
            "label": "Build (Release - Any CPU)",
            "group": "build",
            "type": "shell",
            "windows": {
                "command": "xbuild"
            },
            "linux": {
                "command": "msbuild"
            },
            "args": [
                "/p:Configuration=Release",
                "/p:Platform='Any CPU'",
                "Sharpcraft.sln"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        },
        {
            "identifier": "build:release:x86",
            "label": "Build (Release - x86)",
            "group": "build",
            "type": "shell",
            "windows": {
                "command": "xbuild"
            },
            "linux": {
                "command": "msbuild"
            },
            "args": [
                "/p:Configuration=Release",
                "/p:Platform=x86",
                "Sharpcraft.sln"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        },
        {
            "identifier": "build:release:x64",
            "label": "Build (Release - x64)",
            "group": "build",
            "type": "shell",
            "windows": {
                "command": "xbuild"
            },
            "linux": {
                "command": "msbuild"
            },
            "args": [
                "/p:Configuration=Release",
                "/p:Platform=x64",
                "Sharpcraft.sln"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        },
        {
            "identifier": "build:debug",
            "label": "Build (Debug)",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "dependsOn": [
                "build:debug:anycpu"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        },
        {
            "identifier": "build:release",
            "label": "Build (Release)",
            "group": "build",
            "dependsOn": [
                "build:release:anycpu"
            ],
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false
            },
            "problemMatcher": "$msCompile"
        }
    ]
}

Call stack (as found in the window log output) is as follows:

[2018-07-10 19:33:08.772] [renderer1] [error] Cannot read property 'value' of undefined: TypeError: Cannot read property 'value' of undefined
    at e.collectVariables (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2989:231)
    at e.collectCommandVariables (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2988:348)
    at e.collectTaskVariables (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2988:191)
    at e.executeCommand (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2978:179)
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2977:948
    at Object.g [as _notify] (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:150:807)
    at Object.enter (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:154:85)
    at n.Class.derive._oncancel._run (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:155:896)
    at n.Class.derive._oncancel._completed (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:155:337)
    at l (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:158:855)
    at n.Class.derive.join.r.forEach.j.then.o.(anonymous function) (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:159:45)
    at Object.g [as _notify] (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:150:807)
    at Object.enter (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:154:85)
    at n.Class.derive._oncancel._run (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:155:896)
    at n.Class.derive._oncancel._completed (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:155:337)
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2982:282
    at e.fire (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:171:344)
    at t._onProcessExit (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3410:363)
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3408:259
    at e.fire (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:171:344)
    at t._onExit (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3251:364)
    at ChildProcess.<anonymous> (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3250:153)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at Process.__dirname.ChildProcess._handle.onexit (internal/child_process.js:215:12)

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jul 11, 2018
@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Sep 7, 2018
@weinand weinand added api and removed api labels Sep 13, 2018
@rhummelmose
Copy link

Seeing this as well on macOS 10.14.2 with VSCode 1.30.0, running a simple composite task:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Run Functions",
      "type": "shell",
      "command": "sh scripts/functions_host_background.sh",
      "problemMatcher": []
    },
    {
      "label": "Stop Functions",
      "type": "shell",
      "command": "tmux kill-session -t azure-functions-playground",
      "problemMatcher": []
    },
    {
      "label": "Compile TypeScript",
      "type": "shell",
      "command": "tsc --outDir TypeScriptFunction --sourceMap --lib es2015 TypeScriptFunction/index.ts",
      "problemMatcher": []
    },
    {
      "label": "Compile TS, Run Functions",
      "type": "shell",
      "dependsOn": [
        "Compile TypeScript",
        "Run Functions"
      ],
      "problemMatcher": []
    }
  ]
}

The content of the script is as follows:

tmux kill-session -t azure-functions-playground
tmux start-server
tmux new-session -d -s azure-functions-playground -n host
tmux send-keys -t azure-functions-playground:host "func host start --language-worker -- \"--inspect=5858\"" C-m

@weinand
Copy link
Contributor

weinand commented Nov 9, 2020

This looks more like a task issue.
But its rather old - @alexr00 feel free to close.

@alexr00 alexr00 closed this as completed Nov 10, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues
Projects
None yet
Development

No branches or pull requests

4 participants