Arduino Zero debug error with IDE 2.0

I am trying to debug Arduino Zero with Arduino IDE 2.0.
When I hit 'Start Debugging' for the first time it works.
But after I stop the debugging and try to restart
I got an error "Request 4 cancelled on connection close"
and the debugger does not start.
Anyone can help me to figure out this situation?

Hi @hgycap.

Please provide detailed instructions I can follow to exactly replicate this procedure. I did some experiments with my Zero and the Arduino IDE 2.x integrated debugger and was not able to reproduce that error.

Where is the error shown? Is it in the "Debug Console" view, in a notification, somewhere else?

If there is any additional text, please post all of it.

  1. Type in or open an example.
  2. Open the debug panel.
  3. Put a breakpoint.
  4. Start debugging with the 'Start Debugging' button in the debug panel.
  5. Stop the debugging with the 'Stop' button in the debug panel.
  6. Start debugging again with the 'Start Debugging' button in the debug panel.
  7. Then I got an error as in the attached image.

One curious thing is that I can restart a debugging session with the blink sketch in examples.
But I got an error with the sketch attached above. :frowning:

Same failure message for me.
If I rename the sketch, debugging is possible again.

Thank you very much.
But for me, some work but some do not.

Here is another problem.
For the sketches unable to debug has an empty launch.json
when I press the "Open launch.json" button in debug panel.
Of course, after I renamed the sketch.
It looks like this:

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. "version": "0.2.0", "configurations": [] } 

"launch.json" is not an auto-generated one?
Is there any way to set up manually the content of launch.json?

Hi @hgycap and @peter28357 I am able to reproduce the problem and found it is caused by having a "watch" expression configured, as you can see here in the screenshot shared by @hgycap:


I have submitted a bug report to the Arduino IDE developers:


The workaround is to remove any watch expressions before starting the IDE:

  1. Hover the mouse pointer over the heading of the "WATCH" section in the debugger view. You will now see an icon with an X at the right side of the heading:
    image
    Click that icon.
  2. Start the debugger.
  3. Replace any watch expressions you need.

Please let me know if you have any questions or problems while following those instructions.

Thank you very much.
Your solution works for me.
Thank you again. :star_struck:

You are welcome. I'm glad if I was able to be of assistance.

Thanks also to you for bringing this problem to our attention. I received a couple of reports of it previously, but was not able to reproduce the problem at that time. The information you shared gave me the essential clue that the presence of a watch expression was the required condition.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.