Debugging in VSCode results in error.

Hi,

First time trying Unity and I’m having an issue with debugging scripts. Specifically, I’m getting the following error when when starting a debug run by pressing the “Start debugging” button in VS Code to attach to the Unity Editor:

2019-12-02 23:13:27.784] [renderer1] [error] timeout after 500 ms: Error: timeout after 500 ms
at t.RawDebugSession.handleErrorResponse (file:///usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2798:1003)
at file:///usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2798:434
at async t.RawDebugSession.shutdown (file:///usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2796:536)

This is the output from the console. It looks as if it attaches, but then times out?

UnityDebug: Initializing
UnityDebug: Searching for Unity process 'Unity Editor'
UnityDebug: Attached to Unity process 'Unity Editor (Unity)' (14608)

I’m running Unity and VSCode as a regular user.
I’ve tried restarting both Unity and VS Code but the error remains.

What to do?

System info:

System:
Pop_OS! 19.10

VSCode Unity plugin 2.7.2

Unity:
Version 2019.3.0f1 (ffacea4b84e7) Personal
Fri, 22 Nov 2019 03:55:52 GMT
Branch: 2019.3/staging

VSCode:
Version: 1.40.2
Commit: f359dd69833dd8800b54d458f6d37ab7c78df520
Date: 2019-11-25T14:54:40.719Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Linux x64 5.3.0-22-generic

Anyone with any hint? Is there a better place to ask this?

It seems the problem arises as soon as a break point is hit. Since I had breakpoints on Start() and Update() a breakpoint were guaranteed to be hit as soon as the debugger attached to Unity.

The question is now, what am I doing wrong, surely breakpoints are supposed to work?

Hi,
I’m experiencing the same problem but on macOS. I cannot debug my app anymore using Visual Studio Code. However I can debug the same app using Visual Studio for Mac.

macOS: 10.15.1 (19B88)
Unity: 2019.2.13f1
VSCode plugin: Debugger for Unity 2.7.2

VSCode:
Version: 1.40.2
Commit: f359dd69833dd8800b54d458f6d37ab7c78df520
Date: 2019-11-25T14:52:45.129Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.0.0

So based on a data set of two, the VS Code extension is the cause of the problem.

I downloaded Jetbrains Rider and it can debug just fine so it does seems the VS Code extension is the cause. I’ll file an issue pointing to this thread.

@permalmberg It seems that there is newer version of plugin (pre-release at the moment) available as described here https://github.com/Unity-Technologies/vscode-unity-debug/issues/145

Did you try it?

I think I’m going to go with Rider instead, seems to be much more competent.

Yes, just checked and I’m able to debug now after updating “Debugger for Unity” plugin to 3.0.1 version installing it VSCode manually from “vsix”.