M5Stack WiFi problem

The error I am getting is:

> Executing task in folder M5STACK Test: C:\Users\Paul\.platformio\penv\Scripts\platformio.exe device monitor <

--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on COM9  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
figsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
assertion "dataSize == readSize" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_storage.cpp", line 419, function: esp_err_t nvs::Storage::readMultiPageBlob(uint8_t, const char*, void*, size_t)
abort() was called at PC 0x400fc443 on core 1

Backtrace: 0x4008c434:0x3ffb1b10 0x4008c665:0x3ffb1b30 0x400fc443:0x3ffb1b50 0x400dee13:0x3ffb1b80 0x400def20:0x3ffb1c00 0x400ddfea:0x3ffb1c60 0x400de51d:0x3ffb1ca0 0x401265b2:0x3ffb1cc0 0x401267a6:0x3ffb1d10 0x401267f9:0x3ffb1d40 0x400e17e7:0x3ffb1d60 0x400e193a:0x3ffb1d80 0x400d595d:0x3ffb1da0 0x400d1594:0x3ffb1dc0 0x400d16b1:0x3ffb1ec0 0x400d1aa9:0x3ffb1ee0 0x400d0f77:0x3ffb1f30 0x400d2e47:0x3ffb1fb0 0x40088b7d:0x3ffb1fd0

Code

#include <M5Stack.h>
#include <WiFi.h>

    IPAddress local_IP(192, 168, 1, 110);
    IPAddress gateway(192, 168, 1, 254);    // Set your network Gateway usually your Router base address
    IPAddress subnet(255, 255, 255, 0); 
    IPAddress dns(192,168,1,254);           // Set your network DNS usually your Router base address
    const char* ssid = "BTHub6-C5H2";
    const char* password = "****************";

    void handleNotFound();
    void handleRoot();
//########################################################################################
void setup() {
  Serial.begin(115200);
  //M5.begin();
  
  
  WiFi.config(local_IP, gateway, subnet, dns);
  WiFi.begin(ssid, password);
  //while (WiFi.status() != WL_CONNECTED) {
    //delay(500);
    //Serial.print('.');
    //Serial.println("WiFi STATION Failed to configure Correctly"); 
  //}
  Serial.println("\nConnected to " + WiFi.SSID() + " Use IP address: " + WiFi.localIP().toString()); 
  Serial.println("WiFi ON");

 /////////////////////////////////  My Request commands   /////////////////////////////////
  //server.on("/", handleRoot);
  //server.on("/test", []() { server.send(200, "text/plain", "Server status is OK"); }); // Simple server test by providing a status response

  //server.on("/reset", ReSet);
  //server.onNotFound(handleNotFound); // When a client requests an unknown URI for example something other than "/")
  

  //server.begin();
  
}
//###################################################################################
void handleRoot() { 
}
//////////////////////////////////  UNKNOWN HTML COMMAND  /////////////////////////////////////////////
void handleNotFound(){
}
void loop() {
  // put your main code here, to run repeatedly:
}

Platfomio.ini

;
;   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

[env:m5stack-core-esp32]
platform = espressif32
board = m5stack-core-esp32
framework = arduino
monitor_speed = 115200
upload_speed=921600
;upload_protocol = espota
;upload_port=192.168.1.100
lib_deps = 
    M5Stack
    TaskScheduler

as soon as you run:

WiFi.config(local_IP, gateway, subnet, dns);
WiFi.begin(ssid, password);

it reboots
Any Thoughts?