Witam,
jestem początkującym programistą. Ostatnio napisałem program do łączenia się z mikrokontrolerem przez port szeregowy. Transmisja działa poprawnie, ale problem pojawia się gdy próbuję ją wyłączyć. Wówczas dostaję taki komunikat i program się zamyka.
"Program has encountered a problem and needs to close. We are sorry for the inconvenience."
Co jest w nim nie tak?
Oto mój kod:

private void connectToolStripMenuItem_Click(object sender, EventArgs e)
        {
         if (_continue == false)
            {
                rs232 = new Thread(rs);
                if (_serialPort.IsOpen)
                    _serialPort.Close();

                _serialPort.Open();
                _continue = true;
		    rs232.Start();
            }
            else
            {
                _continue = false;
                rs232.Abort();
                _serialPort.Close();
            }
         }
public void rs()
        {
            short odb; 
            while (_continue)
            {
                try
                {
                    string message = _serialPort.ReadLine();
                    string[] odstepy = new string[] {"C", " "};
                    string[] message_podzielone = message.Split(odstepy,                                                                                         StringSplitOptions.RemoveEmptyEntries);
                        
                        short j = 0;
                        short index = 0;
                        foreach (string str in message_podzielone)
                        {
                            if (str == "") break;

                            if (j == 0)
                            {
                                index = System.Int16.Parse(str) ;
                                j = 1;
                            }
                            else
                            {
                                short wartosc = System.Int16.Parse(str);
                                if (wartosc > 255) wartosc = 255;
                                value[index, 0] = wartosc;
                                j = 0;
                            }
                        }
                }
                catch (TimeoutException) { }
             }
         }
</cpp>

Proszę o pomoc.