C# Winform freezing on SerialPort.Close

前端 未结 4 1051
闹比i
闹比i 2021-02-06 01:14

I have a winform program that does some asynchronous IO on a SerialPort. However, I\'m periodically running into an issue with the program freezing on the SerialPo

4条回答
  •  悲哀的现实
    2021-02-06 01:36

    I had a same problem. I solved this problem by using SerialPortStrem library. You can install by Nuget Pageckage Installer.

    SerialportStream libary has the following advantages.

    • An independent implementation of System.IO.Ports.SerialPort and SerialStream for better reliability and maintainability.

    After using SerialPortStream library, I hadn't UI freezing problem such as deadlock in WPF. I think the same issue in Windows forms. so, use the SerialPortStream library.

    This library is obviously a solution to solve the UI Freezing.

提交回复
热议问题