.Net serial port Basestream reader : My app in c# read integers (string "X/n") from serial port but it isn't work correctly, after sending 30 lines starts to send 1-2 digits with spaces. Is that something with buffor? I try use BaseStream.ReadAsync, but it make too many errors. I'm a novice programmer so please simple explanation.

    

        SerialPort serialPort;
            private Action startReading;
            int bufferLength = 4096;
    
            public Form1()
            {
                InitializeComponent();
            }
    
            public bool Open()
            {
                serialPort = new SerialPort("COM4", 9600, Parity.None, 8, StopBits.One);
                bool result = false;
                try
                {
                    
                    this.serialPort.Open();
                    result = true;
                    startReading = StartAsyncSerialReading;
                    startReading();
                }
                catch (Exception)
                {
                    this.Close();
                    result = false;
                }
                return result;
    
            }
    
            private void StartAsyncSerialReading()
            {
                byte[] buffer = new byte[bufferLength];
    
                serialPort.BaseStream.BeginRead(buffer, 0, bufferLength, delegate (IAsyncResult ar)
                {
                    try
                    {
                        if (serialPort.IsOpen)
                        {
                            int actualLength = serialPort.BaseStream.EndRead(ar);
                            byte[] received = new byte[actualLength];
                            Buffer.BlockCopy(buffer, 0, received, 0, actualLength);
                            string data = Encoding.ASCII.GetString(received, 0, actualLength);
                            Console.WriteLine(data);
    
                        }
                    }
    
                    catch (IOException exc)
                    {
                        ## Heading ##
                    }
    
                    if (serialPort.IsOpen)
                        startReading();
    
                }, null);
    
            }
    public void ClosePort()
            {
                this.serialPort.Close();
                this.serialPort.Dispose();
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                ClosePort();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                Open();
                StartAsyncSerialReading();
            }