platformio-vscode-ide icon indicating copy to clipboard operation
platformio-vscode-ide copied to clipboard

Cannot read properties of undefined (reading ‘id’)

Open alanmasu opened this issue 1 year ago • 9 comments

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/[email protected]

[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 = [email protected]
board = esp01


[env:esp32]
extends = env:esp
platform = [email protected]
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

alanmasu avatar Feb 17 '24 14:02 alanmasu

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

  • after switching the [env] there is some activity from PlatformIO extension, showing a clock badge on the PlatformIO icon in the left-side taskbar.

  • if you try to build before this activity is completed, you get the Cannot read properties of undefined (reading ‘id’) error. That’s ok, it’s busy.

  • after some time working (typically a few hours), even if you wait until the environment switching activity is completed, this error also pops up. It only pops up when using the bottom toolbar. When using the left-side bar (Project Tasks), it still works. The problem is not only for build, also for test.

  • when you exit VSCode and re-open it, the bottom toolbar works again.

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)

Strooom avatar Feb 17 '24 14:02 Strooom

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

mattia424 avatar Feb 24 '24 18:02 mattia424

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.

QuinveY avatar Mar 17 '24 22:03 QuinveY

+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 avatar Mar 26 '24 10:03 andyjbm

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.

andyjbm avatar Mar 26 '24 10:03 andyjbm

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

pdurys avatar May 27 '24 21:05 pdurys

POSSIBLE TEMPORARY SOLUTION

I have such a problem, when the CMake Extension (v.0.0.17, id: twxs.cmake) for VSCode is enabled.

Disabling of Extention solves the problem.

rpolitex avatar Aug 20 '24 11:08 rpolitex

Ok, thanks for that hint. I have CMake also enabled. Will disable it and keep an eye if this solves it for me.

Strooom avatar Aug 20 '24 15:08 Strooom