Skip to content

Commit

Permalink
fix:?又是一个陈年老bug,先这么改改推上去看看还会不会出现
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxuuu committed Nov 9, 2022
1 parent e4b0196 commit 721d2f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions llcom/Model/Uart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ namespace llcom.Model
{
class Uart
{
//废弃的串口对象,存放处,尝试fix[System.ObjectDisposedException: 已关闭 Safe handle]
//https://drdump.com/Problem.aspx?ProblemID=524533
private List<SerialPort> useless = new List<SerialPort>();

public SerialPort serial = new SerialPort();
public event EventHandler UartDataRecived;
public event EventHandler UartDataSent;
Expand Down Expand Up @@ -104,6 +108,8 @@ private void refreshSerialDevice()
catch { }
});
Tools.Logger.AddUartLogDebug($"[refreshSerialDevice]new");
lock(useless)//存起来
useless.Add(serial);
serial = new SerialPort();
//声明接收到事件
serial.DataReceived += Serial_DataReceived;
Expand Down
8 changes: 4 additions & 4 deletions llcom/llcom.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="ScottPlot, Version=4.1.58.0, Culture=neutral, PublicKeyToken=86698dc10387c39e, processorArchitecture=MSIL">
<HintPath>..\packages\ScottPlot.4.1.58\lib\net462\ScottPlot.dll</HintPath>
<Reference Include="ScottPlot, Version=4.1.59.0, Culture=neutral, PublicKeyToken=86698dc10387c39e, processorArchitecture=MSIL">
<HintPath>..\packages\ScottPlot.4.1.59\lib\net462\ScottPlot.dll</HintPath>
</Reference>
<Reference Include="ScottPlot.WPF, Version=4.1.58.0, Culture=neutral, PublicKeyToken=e53b06131e34a3aa, processorArchitecture=MSIL">
<HintPath>..\packages\ScottPlot.WPF.4.1.58\lib\net461\ScottPlot.WPF.dll</HintPath>
<Reference Include="ScottPlot.WPF, Version=4.1.59.0, Culture=neutral, PublicKeyToken=e53b06131e34a3aa, processorArchitecture=MSIL">
<HintPath>..\packages\ScottPlot.WPF.4.1.59\lib\net461\ScottPlot.WPF.dll</HintPath>
</Reference>
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.2.12.0\lib\net46\Serilog.dll</HintPath>
Expand Down
4 changes: 2 additions & 2 deletions llcom/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
<package id="PropertyChanged.Fody" version="3.4.0" targetFramework="net462" />
<package id="RestSharp" version="106.15.0" targetFramework="net462" />
<package id="ScottPlot" version="4.1.58" targetFramework="net462" />
<package id="ScottPlot.WPF" version="4.1.58" targetFramework="net462" />
<package id="ScottPlot" version="4.1.59" targetFramework="net462" />
<package id="ScottPlot.WPF" version="4.1.59" targetFramework="net462" />
<package id="Serilog" version="2.12.0" targetFramework="net462" />
<package id="Serilog.Sinks.Console" version="4.1.0" targetFramework="net462" />
<package id="Serilog.Sinks.File" version="5.0.0" targetFramework="net462" />
Expand Down

0 comments on commit 721d2f1

Please sign in to comment.