My standalone ATMEGA32U4 based board with an Arduino Micro bootloader was working fine with the code (part of which is shown below) until I decided to comment out the line WiFi.init(&Net); and uploaded the code again.
After that, i am unable to upload anything, the Serial Port is no longer detected and I cant even burn the bootloader with a programmer! The MCU oscillator is still working fine which was tested with an oscilloscope. The bad news is that I was even able to ..replicate the above with a second board which is now also bricked!!
Since you only posted a fragment of your code, it's hard to say for sure what's in play but understand that it is easy to hose yourself with the 32U4.
If you use the USB/serial port in your code for something other than a dedicated port with which to communicate with the IDE, you lose your ability to use the bootloader. It appears like the bootloader is gone, but it is still there, it's just being ignored since other code has exclusive use of the port.
This gotcha is why most of the Arduino 32U4 based USB demo programs provide a hardware method of disabling the user's USB portion of the program, to restore bootloader functionality.
Reflashing the bootloader erases all of the devices flash - so the offending user program is wiped in the process and things return to normal, the user thinks it was a bad bootloader but that's really not the case.
No am not using Serial for anything else other than commication with PC. I am however using 2 software serial ports as well as the serial1 hardware port.