[Mono-dev] Mono 2.4 Windows - SerialPort.BytesToRead NullReferenceException

Alan McGovern alan.mcgovern at gmail.com
Wed Apr 29 03:24:25 EDT 2009


Hi,

Could you attach that testcase to a bug report and add a verbal description
of what exactly is wrong at http://bugzilla.novell.com . Also mention the
version of windows you're on (which is it?). That's the best way to get the
issue fixed.

Thanks,
Alan.

On Wed, Apr 29, 2009 at 7:50 AM, Rytis Ilciukas (rick) <zibalas at gmail.com>wrote:

>
> I'm trying to run a very simple SerialPort test app (see the code below) on
> Windows using Mono and i get
>
> System.NullReferenceException: Object reference not set to an instance of
> an
> obj
> ect
>  at (wrapper managed-to-native)
> System.IO.Ports.WinSerialStream:ClearCommError
> (int,uint&,System.IO.Ports.CommStat&)
>  at System.IO.Ports.WinSerialStream.get_BytesToRead () [0x00000]
>  at System.IO.Ports.SerialPort.get_BytesToRead () [0x00000]
>  at (wrapper remoting-invoke-with-check)
> System.IO.Ports.SerialPort:get_BytesTo
> Read ()
>  at PortGrindTest.Program.ThreadFunction () [0x00000]
>
> I've searched the forum and only found posts dating back to 2008 and Mono
> 1.x So here's my 2ct. It seems that Mono is still very very unstable :( By
> the way maybe this isn't the place to post bugs?
>
> Code:
>                    SerialPort port = new SerialPort("COM6");
>                    port.ReadTimeout = 2000;
>                    port.WriteTimeout = 1000;
>                    Console.WriteLine("Thread {0} opened port",
> Thread.CurrentThread.ManagedThreadId);
>                    lock (this)
>                    {
>                        port.Open();
>                    }
>                    try
>                    {
>                        port.WriteLine("ATE");
>                        port.WriteLine("AT");
>                        do
>                        {
>                            string line = port.ReadLine();
>                            Console.WriteLine("Received {0}", line);
>                        } while (port.BytesToRead != 0);
>                    }
>                    catch (TimeoutException e)
>                    {
>                        Console.WriteLine("Thread {0} {1} {2}",
> Thread.CurrentThread.ManagedThreadId, freePort.Name, e.Message);
>                    }
> --
> View this message in context:
> http://www.nabble.com/Mono-2.4-Windows---SerialPort.BytesToRead-NullReferenceException-tp23291526p23291526.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090429/5a6894dd/attachment-0001.html 


More information about the Mono-devel-list mailing list