diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d5587d..c59e7c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,9 @@ jobs: - name: Set up .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: "8.0.x" + dotnet-version: | + 8.0.x + 10.0.x - name: Build run: dotnet build StreamFrame.slnx -c Release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 866cf7e..4a7e28f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,9 @@ jobs: - name: Set up .NET uses: actions/setup-dotnet@v6 with: - dotnet-version: "8.0.x" + dotnet-version: | + 8.0.x + 10.0.x - name: Verify tag matches csproj versions if: startsWith(github.ref, 'refs/tags/') diff --git a/CHANGELOG.md b/CHANGELOG.md index b898ceb..7832eed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - CI Actions 升级到 Node 24 运行时:`actions/checkout@v7`、`actions/setup-dotnet@v6`、`softprops/action-gh-release@v3`(消除 Node 20 弃用告警)。 ### 新增 +- 多目标框架(第一阶段):`net8.0;net10.0`——net10 为当前 LTS(支持至 2028-11),CI 双框架全量测试;net9+ 目标采用 `System.Threading.Lock`。 - 帧定界基准测试 `bench/StreamFrame.Benchmarks`(BenchmarkDotNet):LengthPrefix/StxEtx 的流式 vs 纯函数编码对比与切帧吞吐,为"流式零拷贝"说法提供可复现数据。 - 项目 LOGO(`docs/logo/`,SVG 母版 + PNG),README 双语版接入展示、两个 NuGet 包启用包图标(随下个版本发布生效)。 - README 新增 CI 构建状态徽章;main 分支保护(必须走 PR 且 CI 通过、禁 force push/删除、强制线性历史)。 diff --git a/src/StreamFrame.Protocols.Xml/StreamFrame.Protocols.Xml.csproj b/src/StreamFrame.Protocols.Xml/StreamFrame.Protocols.Xml.csproj index b10b3c2..71bff1b 100644 --- a/src/StreamFrame.Protocols.Xml/StreamFrame.Protocols.Xml.csproj +++ b/src/StreamFrame.Protocols.Xml/StreamFrame.Protocols.Xml.csproj @@ -17,7 +17,7 @@ - net8.0 + net8.0;net10.0 enable enable true diff --git a/src/StreamFrame/Connection/StreamConnection.cs b/src/StreamFrame/Connection/StreamConnection.cs index 86e95dd..dd606ca 100644 --- a/src/StreamFrame/Connection/StreamConnection.cs +++ b/src/StreamFrame/Connection/StreamConnection.cs @@ -62,7 +62,11 @@ public string? RemoteIpAddress private readonly ICodec _codec; private readonly StreamConnectionOptions _options; +#if NET9_0_OR_GREATER + private readonly Lock _sessionGate = new(); // System.Threading.Lock(net9+,比 monitor 锁更轻量) +#else private readonly object _sessionGate = new(); +#endif private Pipe? _pipe; private CancellationTokenSource? _sessionCts; private Task? _receiveTask; diff --git a/src/StreamFrame/StreamFrame.csproj b/src/StreamFrame/StreamFrame.csproj index 6129063..8f68da2 100644 --- a/src/StreamFrame/StreamFrame.csproj +++ b/src/StreamFrame/StreamFrame.csproj @@ -1,7 +1,7 @@ - net8.0 + net8.0;net10.0 enable enable true @@ -31,7 +31,7 @@ - + diff --git a/test/StreamFrame.Tests/StreamFrame.Tests.csproj b/test/StreamFrame.Tests/StreamFrame.Tests.csproj index d67f1b2..7e4b086 100644 --- a/test/StreamFrame.Tests/StreamFrame.Tests.csproj +++ b/test/StreamFrame.Tests/StreamFrame.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net8.0;net10.0 enable enable