Skip to content

Platform installation prompt only made for boards listed in oldest release #979

Closed
@per1234

Description

@per1234

Describe the problem

The "Select Board" dialog provides a searchable list of all available boards for selection by the user.

This list is populated from two distinct sources:

  • Boards definitions contained in the installed Arduino boards platforms
  • Boards listed in the definition of the newest release of each of the non-installed platforms available from the package indexes

The selected board can not be used if its platform is not installed so the IDE must prompt the user to install the necessary platform if a board from the latter source is selected. This is done via a notification which communicates the requirement to the user and offers to install the platform.

🐛 The platform installation prompt is not shown if a selected non-installed board is not listed in the oldest platform release definition.

To reproduce

  1. If the "Arduino megaAVR Boards" platform is already installed, use the Arduino IDE "Boards Manager to uninstall it.
    This platform was chosen arbitrarily for the sake of the demo. The bug will occur with any platform with a board listed in the newest platform release definition which is not present in the oldest.
  2. Open the "Board Selector" menu.
  3. Click on "Select other board and port...".
  4. Select "Arduino Nano Every" from the "BOARDS" menu in the "Select Board" dialog.
    This board was selected because it is not present in the oldest platform release definition.
  5. Select any port.
    This step is required as a workaround for Platform installation only offered if port is selected #854
  6. Click the OK button.
    🐛 The platform installation prompt does not appear. If the user attempts to compile, they will get a cryptic "Missing FQBN" error message. If they try to upload, nothing at all will happen.
  7. Open the "Board Selector" menu.
  8. Click on "Select other board and port...".
  9. Select "Arduino Uno WiFi Rev2" from the "BOARDS" menu.
    This board is present in the oldest platform release definition.
  10. Click the OK button.
    🙂 The expected platform installation prompt appears:
    image

Expected behavior

Platform installation prompt always appears after selecting a non-installed board from the "Select Board" dialog.

Arduino IDE version

2.0.0-rc6-snapshot-289f9d7

Operating system

Windows

Operating system version

10

Additional context

The origin of the mismatch between the data used to populate the "BOARDS" menu in the "Select Board" dialog and the data used to determine which platform should be installed for that board is here:

packages.set(id, toPackage(platform));

The platform releases in groupedById are sorted in the following order:

  1. Installed release, if the platform is installed
  2. Non-installed releases in ascending order

This means that the "package" data set by toPackage is based on the oldest release when the platform is not installed.

The obvious fix would be to sort the non-installed platform releases in descending order, which would result in the "package" data being based on:

  • If platform is installed: installed release
  • If platform is not installed: newest release

But it is not clear to me whether there is a specific reason for the current ascending sort order.


The packages[*].platforms[*].boards[] contents in the arduino:[email protected] release used to populate the "BOARDS" menu

{
  "name": "Arduino Uno WiFi Rev2"
},
{
  "name": "Arduino Nano Every"
}

The packages[*].platforms[*].boards[] value in the arduino:[email protected] release used by BoardsAutoInstaller:

{
  "name": "Arduino Uno WiFi Rev2"
}

I don't expect to find this quantity of code that is not directly related to the GUI in the Arduino IDE code base. I recommend evaluating whether it can be provided by Arduino CLI instead.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions