Reading a packet of data in one call

char buffer[Serial.available()];
  while(Serial.available())

These two function calls may not return the same values. Data may arrive while the while loop is running, allowing you to overflow your buffer.

Dynamically sizing the buffer this way is a really bad idea. A statically sized, global buffer is a much better idea.

    Serial.readBytes(buffer,Serial.available());

Another call, which can return a 3rd value. Do NOT do this. If you MUST use a dynamic array, make ONE call to Serial.available() and record that value. Ditch the while loop, using an if statement, instead.

Any big mistakes that I missed?

You failed to post all of your Arduino code. You failed to post any of your C# code.