How to solve: unbound breakpoints in vscode to debug through docker

How to solve: unbound breakpoints in vscode to debug through docker

Table of contents

No heading

No headings in the article.

While I was working on some new project, then I found a weird thing that all breakpoints in vscode are unbound.Everything looks good, but the breakpoints did not work all the time.After looking into many websites, I still could not find the reason to cause that issue.

But someone who is in stackoverflow mentioned me that we can enable trace in launch.json file by adding this setting:

“trace”: true

Then some output would display in debug termnial:

Verbose logs are written to:
/somepath/vscode-debugadapter-xxxxxx.json.gz

We can upload that gz file to this link: https://microsoft.github.io/vscode-pwa-analyzer/index.html

It is a tool to analyze the content of xxx.json.gz file.

Finally I found the real path in container is not same as I except, I found I wrote the wrong work dir in Dockerfile, so I changed it to be:

WORKDIR /my-api

Then I restart the container and restart the debug in vscode, it works! I did some research for this setting like below:

The WORKDIR command is used to define the working directory of a Docker container at any given time. The command is specified in the Dockerfile.

reading resource: stackoverflow discuss