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

Communicate to the user cause of debugger not starting with uncompiled sketch #808

Closed
per1234 opened this issue Feb 4, 2022 · 2 comments · Fixed by #1809
Closed

Communicate to the user cause of debugger not starting with uncompiled sketch #808

per1234 opened this issue Feb 4, 2022 · 2 comments · Fixed by #1809
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: debugger Related to the integrated debugger type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented Feb 4, 2022

Describe the current behavior

The Arduino IDE integrated debugger requires the sketch binary produced by compilation of the sketch. The path to this file is provided to the debugger via the launch.json file that is automatically generated by the IDE when the user clicks the "Start Debugging" button on the button bar.

For this reason, the debugger can not be initialized if the user didn't know or remember to compile the sketch before clicking the button.

🙁 The IDE does not communicate this problem to the user other than that clicking the "Start Debugging" button has no effect.

To reproduce

  1. Select File > New from the Arduino IDE menus.
  2. Select Tools > Board > Arduino SAMD (32-bits ARM Cortex-M0+) Boards > Arduino Zero (Programming Port from the Arduino IDE menus.
    There is no need to have a Zero connected to your computer for this demo.
  3. Click the "Start Debugging" button on the button bar.
  4. Wait as long as you need to feel certain that nothing is going to happen.

🙁 There is no feedback from the IDE that the debugger couldn't start, and no indication of what is wrong.

Describe the request

Display a notification when the IDE fails to initialize the debugger. Explain that they must compile or upload the sketch first.

Desktop

  • OS: Windows 10, Ubuntu 20.04
  • Version: 2.0.0-rc3-snapshot.759b410
    Date: 2022-01-31T13:15:29.574Z
    CLI Version: 0.20.2 [13783819]

Additional context

The "vscode-arduino-tools" extension that generates the debugger configuration knows of this issue and even attempts to generate an error message:

https://github.com/arduino/vscode-arduino-tools/blob/5382501e0b35f500bc8dcc9ffe877cdf37935552/src/extension.ts#L118

However, this error message is never shown to the user by the IDE.


The poor user experience of no feedback in this situation is exacerbated by the fact that there is also no immediate feedback after clicking the "Start Debugging" button when all is well, and it takes quite some time for the debugger to finally start up. In addition, you are punished if you get impatient and click the button multiple times. So the IDE trains you to expect some indeterminate wait for the debugger, and this causes you to wait quite some time before finally concluding something must be wrong (still with no indication of what went wrong).

It may also cause people to attempt to access the debugger via the activity bar icon (#14)

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: debugger Related to the integrated debugger labels Feb 4, 2022
@per1234
Copy link
Contributor Author

per1234 commented Aug 12, 2022

Starting from https://github.com/arduino/arduino-ide/commits/112153fb965f63d952d126c8244cd3f84f0a1a1b, there is now a notification under these conditions:

Error getting Debug info: Compiled sketch not found in C:\Users\per\AppData\Local\Temp\arduino-sketch-C8D178233C0D418F572FEE5FAF047395

However, this is not the notification from vscode-arduino-tools mentioned above, which would look like:

Sketch <sketch path> was not compiled. Please compile the sketch and start debugging again.

The latter communicates the problem much more clearly, but also relies on a fragile pattern matching against the human readable error message from Arduino CLI (which is the error that is now shown in the notification).

So I'm not sure whether or not this should be considered resolved. If the effort is going to be made to maintain custom notification code in arduino/vscode-arduino-tools, then the IDE should take advantage of it. If the custom notification is not going to be used, then that code should be removed from arduino/vscode-arduino-tools and we can settle for the less clear, but still acceptable notification already shown by the IDE.

@kittaakos kittaakos assigned kittaakos and unassigned AlbyIanna Oct 27, 2022
@kittaakos
Copy link
Contributor

However, this is not the notification from vscode-arduino-tools mentioned above, which would look like:

There is a bug here. The string match of the message fragment must be lower-cased, and then users would get the expected notification:
Screen Shot 2023-01-09 at 11 28 41

Since IDE2 will require changes in the VS Code extension anyway, I decided to do the following:

  • if any error occurs when generating the launch.json content for the debugger, the VS Code extensions will throw the error as is, which will be handled on IDE2's side.
  • IDE2 will be able to show whatever error message it wants with possible command actions, such as verify this sketch.
  • There is one down part of this approach the CLI will throw such error message: Compiled sketch not found in C:\Users\per\AppData\Local\Temp\arduino-sketch-C8D178233C0D418F572FEE5FAF047395. IDE2 has to know how the builder generates the temp folder for the sketch on verify: https://github.com/arduino/arduino-cli/blob/c0d4e4407d80aabad81142693513b3306759cfa6/arduino/sketch/sketch.go#L296-L306 and must handle FS paths vs. URI conversion.

kittaakos pushed a commit to arduino/vscode-arduino-tools that referenced this issue Jan 9, 2023
arduino/arduino-ide#808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue Jan 9, 2023
If the sketch has not been verified, IDE2 offers user a verify action.

Closes #808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/vscode-arduino-tools that referenced this issue Jan 10, 2023
arduino/arduino-ide#808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/vscode-arduino-tools that referenced this issue Jan 10, 2023
arduino/arduino-ide#808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue Jan 11, 2023
If the sketch has not been verified, IDE2 offers user a verify action.

Closes #808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue Jan 16, 2023
If the sketch has not been verified, IDE2 offers user a verify action.

Closes #808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue Jan 19, 2023
If the sketch has not been verified, IDE2 offers user a verify action.

Closes #808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos added a commit that referenced this issue Jan 23, 2023
If the sketch has not been verified, IDE2 offers the user a verify action.

Closes #808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@per1234 per1234 added the conclusion: resolved Issue was resolved label Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: debugger Related to the integrated debugger type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants