Sadly your expectation is incorrect, this is a very common expectation, but it is not normally how the serial OS calls can work.
The serial class is not ‘magic’ it receives data into its buffers and when the OS decides its time to make the system aware that some data is available then it raises an event, in this case ‘DataAvailabe’ event.
you can never expect to receive a complete ‘packet’ of data each time the ‘DataAvailable’ event is fired.
an EVENT is just that, something happened in the OS to make the event occur, that event can be at 1 byte, 10 bytes or all the bytes of data sent from the external device.
the event has zero intelligence, it can not know what your intentions are for the data.
you must manage the data when the event occurs.
this can be done with a timer, POLL the serial port at a defined time, this may allow you to get all the ‘packet’ data.
use a ‘start’ or ‘end’ character that is searched for in the received stream, this is usually done with ‘LookAhead’ (my normal way to find ‘packet’ of data).
or some other method using ‘ReadAll’ and then a method to parse the current data for known packet terminators.
Whatever you do, you will have to parse and manage the data, look for a structure in the received data and determine what is good and bad data, there is nothing in Xojo that can do this for you (and no reason why it should).
the serial port (in API1, 19r1 and before) is very reliable and I have a significant number of projects and products using the class in Mac, Linux, Raspberry and win, all work without issue, providing you put some work into them.
if your data is not ASCII values then you need to work on the data in a different way, if it is ASCII it is very easy.
This may sound a bit complex but it is not.
so what is your platform and Xojo version number? that is a good start, a copy of the code you have now that does not work will also make it easier to understand what you might be seeing.
providing you are using API1 serial port I can help you, if you are using API2 (19r2 or 3) then you will need to find someone else to help you as I do not use API2 for any reason.