This is fully compliant with the API. It is not and has never been guaranteed to read everything:
This method returns the contents of the stream and the internal buffer of the SerialPort object as a string. This method does not use timeout. Note that this method may leave trailing leading bytes in the internal buffer, making BytesToRead greater than zero.
In addition, you need to process "not yet in the internal buffer" - you are not just reading, and BytesToRead is positive. This typically involves looping and buffering until a complete message is received.
It is your job to read the correct amount of data using markers such as line ends, or using a length prefix header.
If it works fine on XP, then this is just luck (and maybe some time and / or performance settings).
All of the above applies equally to most inputs, and not just to serial ports; for example, IO file and IO networks work almost in the same way.
source share