Serialport List Read problem and NullReferenceException?

Posted by Plumbum7 on Stack Overflow See other posts from Stack Overflow or by Plumbum7
Published on 2010-12-31T15:18:44Z Indexed on 2010/12/31 15:54 UTC
Read the original article Hit count: 151

Filed under:

Hello everybody,

Using Microsoft VC# 2008 Express (little fact about me : non experience in c#, programskills further very beginnerlevel. This peace op program is to communicate with Zigbee switching walloutlets (switching, status info). and is downloaded from http://plugwiselib.codeplex.com/SourceControl/list/changesets

The problem: NullRefferenceException was UnHandled

 private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
    {// Event for receiving data

        string txt = port.ReadExisting();

        Console.WriteLine(txt);
        List<PlugwiseMessage> msg = reader.Read (Regex.Split (txt, "\r\n" ));
        //Console.WriteLine( msg );
        DataReceived(sender, new System.EventArgs(), msg);

VC# Marks the last line and says msg is empty. so i looked further. Msg come's from txt text is filled with

"000002D200C133E1\r\nPutFifoUnicast 40 : Handle 722 :"< so it goes wrong in or reader.Read or in the List

so i looked further:

 public List<PlugwiseMessage> Read(string[] serialData)
        {
            Console.WriteLine(serialData);
            List<PlugwiseMessage> output = new List<PlugwiseMessage>();
            Console.WriteLine(output);

Both (serialData) as (output); are empty.

So can i assume that the problem is in:

Read(string[] serialData)

But now the questions,

Is Read(string[] serialData) something which is a Windows.Refence or is is from a Method ? and IF this is so is this then reader.READ (how can i find this)? (answered my own question proberly)(method reader)(private PlugwiseReader reader)

So why isn't is working trough the serialData ? or is it the List<PlugwiseMessage> part, but i have no idea how it is filled can sombody help me ?

© Stack Overflow or respective owner

Related posts about c#