Platformio print in setup() bug?

Hello everyone! So after some youtube suggestions from electronic gurus I have decided to try platformio for my ESP32S3 from seed xiao. Everything went smooth before I stumbled across Serial Monitor. It looks like platformio's Serial Monitor cannot print anything inside setup part which is a bummer. I have tried all possible solutions related to this problem shown online: some of them were code with delay() instead of while (!Serial) and vise versa. Changed bunch of things in platform.ini like added flags disabled dtr, rts, changed monitor speed, played with build flags etc, etc. I am not sure if I am looking at the right spot, but my intuition tells me it is a bug. Can anyone confirm or deny it? Here is a simple code I was trying:

#include <Arduino.h>

void setup() {
  Serial.begin(115200);

  while (!Serial) {
  ; // Wait for serial port to connect
  }

  Serial.println();
  Serial.print("Print in void setup(): ");
}

void loop() {

  Serial.println("--l--o--o--p--");

  delay(2000);
}

And the output looks like that
--- forcing DTR inactive
--- forcing RTS inactive
--- Terminal on COM4 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at Redirecting...
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
19:32:35.144 > --l--o--o--p--

Appreciate any help.

I have no problem printing from setup() with platformIO with various different Ardino compatible boards, including an ESP32 dev board. I don't have an ESP32S3, but there's no immediately obvious reason why it would be different. Maybe try a delay(1000) in setup before trying to print, but that's just clutching at a straw.

Hi, thanks for the reply, I have tried this solution already. Unfortunately without success

Does the same code work in the Arduino IDE? If so it might be worth posting in the PlatformIO forum to ask about the problem.

Yes, the code works in Arduino IDE just fine.

The response in the PlatformIO forum is usually quick and high quality. Whenever I've had a problem with it, I usually get the right answer quickly.