Skip to content

Update check on debug config generation fail #30

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

Merged
merged 1 commit into from
Aug 1, 2022
Merged

Update check on debug config generation fail #30

merged 1 commit into from
Aug 1, 2022

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Feb 4, 2022

When sketch debugging is initiated, the extension runs Arduino CLI to get the debugger configuration information. This information is required to generate the launch.json configuration file.

As part of this information is the path to the compiled sketch binary, Arduino CLI checks for the existence of that file, and errors if it is not present (which is usually caused by the user having neglected to compile the sketch):

$ arduino-cli version
arduino-cli.exe  Version: git-snapshot Commit: 200d4b4f Date: 2022-02-03T15:48:11Z

$ arduino-cli sketch new /tmp/NotCompiled
Sketch created in: C:\Users\per\AppData\Local\Temp\NotCompiled

$ arduino-cli debug -I -b arduino:samd:mkrzero --format json /tmp/NotCompiled
Error getting Debug info: Compiled sketch not found in C:\Users\per\AppData\Local\Temp\arduino-sketch-B00E82A5EFC5401167B17E3767CC3A00

The extension has special handling for this specific common error cause, which is based on a fragile string comparison on the human readable error message. As is the nature of such an approach, a seemingly innocuous capitalization change to the message in the Arduino CLI code base (arduino/arduino-cli@75b9760) broke the check.

The quick fix provided here is making the check case insensitive.


NOTE: this is not a true fix. The human readable error message string may change at any time, and is guaranteed to change if non-English localization is enabled.

However, it is less broken after this simple change, and the check is not critical, so I think it is still worthwhile.

When sketch debugging is initiated, the extension runs Arduino CLI to get the debugger configuration information. This
information is required to generate the `launch.json` configuration file.

As part of this information is the path to the compiled sketch binary, Arduino CLI checks for the existence of that
file, and errors if it is not present (which is usually caused by the user having neglected to compile the sketch):

```
Error getting Debug info: Compiled sketch not found in ...
```

The extension has special handling for this specific common error cause, which is based on a fragile string comparison
on the human readable error message. As is the nature of this approach, a seemingly innocuous capitalization change to
the message in the Arduino CLI code base broke the check.

The quick fix provided here is making the check case insensitive.
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Feb 4, 2022
@per1234 per1234 self-assigned this Feb 4, 2022
@per1234 per1234 requested review from davegarthsimpson, francescospissu and kittaakos and removed request for silvanocerza July 31, 2022 21:12
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking care of this 👍

@per1234 per1234 merged commit 54ca0db into arduino:main Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants