WPF Bluetooth Network Stream ReadByte() issue

Jul 11, 2013 at 2:55 PM
Hi Buddy's,
I am trying to collect stream of bytes from a Blue tooth in WPF program. I am calling the ReadBTSignal function from a thread. Thread will execute for every 1 msec.
The below program works fine in winform. It is getting the stream and I didn't have any issues. But in WPF it is hung in the below line
It didn't get any error message and it didn't go to the next line. It is hung in that line.
I tried to execute in the try catch block but it didn't come to the catch block. I have attached the code snippet for your reference and I am using the below namespaces.

using InTheHand.Net;
using InTheHand.Net.Sockets;
using InTheHand.Net.Bluetooth;

public void ReadBTSingle(int AmountData, out int intGetDataLose, out int[] rawdata, out bool[] ChannelEnable)
        private Stream sr;
        int[] intArrayHeader = new int[2];
        for (int x = 0; x < 2; x++)
            intArrayHeader[x] = sr.ReadByte();

This is a show stopper issue and I desperately need some help on this. Please share your inputs.

Jul 11, 2013 at 2:58 PM
The same code works fine in winforms.