VC++ communicates with Arduino

I reference VC++ and Arduino communication over the network via USB.
But I have a serious problem.
I want to use a double-layer if loop,because I want to pass in an instruction to indicate that I am going to pass the value.
however enter the second if loop, C++ forced interrupt arduino busy wait.
Does anyone have a similar experience,please?
Please help me if you can, I will be very grateful to you.

The following reference website is attached.

Attach the picture that actually encountered difficulty

picture1 arduino (I want the result but he is on the Arduino compiler)
picture2 Visual studio (Arduino was forcibly interrupted by VC++)

The following is the arduino code

Here are:

#define BAUD 9600
#define led 13

void setup(){
  pinMode(led, OUTPUT);

void loop(){
  String input;

  if(Serial.available() > 0){
    input = Serial.readStringUntil('\n');
  if(input == "1"){   
       while (Serial.available()<=0){
        input =;
    if(Serial.available() > 0){
    input = Serial.readStringUntil('\n');
    digitalWrite(led, HIGH);
    Serial.println("Led is on");


  if (input == "OFF")
    digitalWrite(led, LOW);
    Serial.println("Led is off");
  input = "";