platformio / platformio-vscode-ide

PlatformIO IDE for VSCode: The next generation integrated development environment for IoT
https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide
Apache License 2.0
1.18k stars 188 forks source link

Cannot read properties of undefined (reading ‘id’) #3982

Open alanmasu opened 4 months ago

alanmasu commented 4 months ago

Hi, I’m using PlatformIO for developing a project whit an RP2040 and an ESP01 connected to it.

So I’ve created multiple environments for differentiating sources, such functionality testing files and real application sources, but also for sources for the ESP01 and the RP2040:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
extra_configs = upload_port.ini
default_envs = pico

[env]
extra_scripts = pre:git_script.py

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.mcu = rp2040
board_build.core = earlephilhower
monitor_speed = 115200
build_src_filter = -<ESP>

[env:test_WebServer]
extends = env:pico
build_src_filter =  -<./main.cpp>
                    +<./common>
                    +<../testing/test_WebServer>
lib_deps =  https://github.com/adafruit/Adafruit-GFX-Library.git#126007f
            https://github.com/adafruit/Adafruit_SSD1306.git#7a4d33e
            https://github.com/adafruit/Adafruit_NeoPixel.git@1.12.0

[env:esp]
framework = arduino
monitor_speed = 115200
board_build.filesystem = littlefs
build_src_filter =  -<.>
                    +<ESP>
lib_deps = https://github.com/cotestatnt/esp-fs-webserver.git#1.2.7

[env:esp01]
extends = env:esp
platform = espressif8266@4.2.1
board = esp01

[env:esp32]
extends = env:esp
platform = espressif32@6.4.0
board = esp32dev

and it’s ok, but when I change the environment buttons in the bottom navigation tab: image

shows the Cannot read properties of undefined (reading 'id') error and for upload/build/etc… I have to use the PlatfomIO tab on the nav bar instead: image

In particular this error is triggered when environment is changed and also after a pair of hours of work! There is a discussion opened also in the Community Forum reachable here

I’m working on Windows 10 and VSCode 1.86.1 and PIO (core: 6.1.14) (Home: 3.4.4) There is any solution?? This is very uncomfortable…

Thanks in advance! Alan

Strooom commented 4 months ago

I’m having this behavior as well, already for several months. Here is what’s happening:

So currently my workaround is to close VSCode and open it again, but still it is an annoying thing.

My setup is Win11 and all up-to-date with PlatformIO.

My repo is this : Strooom/MuMo-v2-Node-SW: Firmware for the Museum Monitor V2 node (github.com) in case you want to check my platformio.ini

I'll try to find a way to reproduce it in a deterministic way. Will comment here if I find one.

Will also ask my colleague working on MacOs if he ever experienced this. (Working on the same repository)

mattia424 commented 4 months ago

Hi, I have this problem too. I have created two envs which differ only by a build_flag and upload_port.

When I use env default it compiles and uploads to both tabs while if I move to env specific I get the toast "Cannot read properties of undefined (reading 'id')"

Platformio version Core 6.1.11-Home 3.4.4

I don't know what other info I could add to help reproduce the problem.

Mattia

QuinveY commented 3 months ago

Exactly the same problem. Using PIO Core: 6.1.10 & PIO Home: 3.4.4

When switching the PIO Project Environment the buttons on the bottom do not work anymore, but on the left side unther project tasks they work fine.

andyjbm commented 3 months ago

+1 Here. Thought I was going mad trying to compile. Happened just after adding another environment. Could no longer use the buttons on the toolbar - getting the error as in the title.

I'm using a dozen or so environments with build flags to define a macro for different code compiling #ifdefs The environment I added was the same as the dozen or so others I have except a build flag -D was changed:

[env:ESP32_s2_mini_NoMsgs] extends = env:Release32_s2_mini build_flags = ${env:Release32_s2_mini.build_flags} -D GENIE_TYPE_NOMSG=true

Ended up here after googling, Hadn't thought to try the Project Tasks list menu and hey presto they work, but the toolbar buttons don't.

My addition. Shortcut keys (for the toolbar buttons) don't work either, however the notification message has a warning triangle whereas pressing a toolbar button gets a notification with a red X. The message is exactly the same.

Andy.

andyjbm commented 3 months ago

Hi Quick addition,

May not be relevant but the more info and all that...

I had a second vscode/platformio instance open with another project. That toolbar still worked while the broken one didn't.

A.

pdurys commented 1 month ago

Same here. I am using latest T-Display-S3 examples. Some envs throws that error right away, some works and at the same time side menu works as expected. Only taskbar throws that error. Interestingly I do not have that problem with projects which have only one env in platformio.ini