PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Bug report

Reply

Bug report

 
Thread Tools Rate Thread
Old 09-03-2007, 09:22 AM   #1
Ole
Guest
 
Posts: n/a
Default Bug report


There is for sure a bug in Compact Framework 2.0 in the System.IO.Ports
namespace. The bug is in the BaudRate property of the SerialPort when a
Bluetooth unit is connected to the Port. The Error can be recreated by
runnning the following code (at least on a Pocket PC 2003 Device):
using System.IO.Ports;

SerialPort Commport = new SerialPort("COM8"); // COM8 is a Bluetooth
outbound port

Commport.Open();
Commport.BaudRate = 115200;

Following exception occurs:
innerException = {System.ArgumentOutOfRangeException: Argument must be
between 0 and 65536.
Parameter name: baudRate
at System.IO.Ports.SerialStream.set_BaudRate()
at System.IO.Ports.SerialPort.set_BaudRate()
at TestCom.Form1.button1_Click()
at System.Windows.Forms.C...

But there is no problem when using the API SetCommState!!!

Thanks
Ole



  Reply With Quote
Old 09-03-2007, 10:01 AM   #2
Ole
Guest
 
Posts: n/a
Default Re: Bug report

To others who are struggling the same problem there is a hint to a
workaround:
Check if the COM port you are trying to set baudrate of is a Bluetooth
module and if it is then Don't set the baud rate! A bluetooth module doesn't
care about baud rates as it is a radio port so even if the baudrate is set
to 9600 it will communicate at 115200. If the port is a normal wired serial
port there is no problem by setting it to 115200.

BR
Ole


"Ole" <ole@blabla.com> wrote in message
news:%23d$eIyiYHHA.2556@TK2MSFTNGP02.phx.gbl...
> There is for sure a bug in Compact Framework 2.0 in the System.IO.Ports
> namespace. The bug is in the BaudRate property of the SerialPort when a
> Bluetooth unit is connected to the Port. The Error can be recreated by
> runnning the following code (at least on a Pocket PC 2003 Device):
> using System.IO.Ports;
>
> SerialPort Commport = new SerialPort("COM8"); // COM8 is a Bluetooth
> outbound port
>
> Commport.Open();
> Commport.BaudRate = 115200;
>
> Following exception occurs:
> innerException = {System.ArgumentOutOfRangeException: Argument must be
> between 0 and 65536.
> Parameter name: baudRate
> at System.IO.Ports.SerialStream.set_BaudRate()
> at System.IO.Ports.SerialPort.set_BaudRate()
> at TestCom.Form1.button1_Click()
> at System.Windows.Forms.C...
>
> But there is no problem when using the API SetCommState!!!
>
> Thanks
> Ole
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off