删除断点n调试模式后,打印机无法打印数据

时间:2019-05-11 07:42:18

标签: c# xamarin printing xamarin.android

这是我在蓝牙打印机上打印数据的代码

using (BluetoothSocket bluetoothSocket = device?.CreateRfcommSocketToServiceRecord(serialUUID))
                            {
                                try
                                {

                                    if (!bluetoothSocket.IsConnected)
                                    {
                                        bluetoothSocket?.Connect();
                                    }

                                    string sss = " Sample Test Line \nSample Test Line";
                                    byte[] buffer = Encoding.UTF8.GetBytes(sss);
                                    bluetoothSocket?.OutputStream.Write(buffer, 0, buffer.Length);
                                    bluetoothSocket.Close();
                                }
                                catch (System.Exception e)
                                {

                                }                           
                            }

当我在调试模式下测试此代码时,仅当我在任意行上设置断点时才打印。但是删除断点后将不打印任何内容。

如何解决这个问题?

0 个答案:

没有答案