From 779c0da23916cf43cc6d5ec339ac005a4aa3bd37 Mon Sep 17 00:00:00 2001 From: Eric Fortin Date: Tue, 22 Jul 2025 14:37:29 -0400 Subject: [PATCH 1/4] .net 6 migration --- NEventSocket/NEventSocket.csproj | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/NEventSocket/NEventSocket.csproj b/NEventSocket/NEventSocket.csproj index 9db4ff8..4f1e32d 100644 --- a/NEventSocket/NEventSocket.csproj +++ b/NEventSocket/NEventSocket.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net9.0 NEventSocket.DotNetCore iamkinetic iamkinetic @@ -12,19 +12,13 @@ FreeSwitch NEventSocket DotNetCore - Fix a few issues with the ObservableSocket. https://github.com/iamkinetic/NEventSocket - - - - - - 2.2.1.0 2.2.1.0 - - + + From 64ed90aa912e4f8d3ca04517dbf26dee2449c3ca Mon Sep 17 00:00:00 2001 From: Eric Fortin Date: Tue, 22 Jul 2025 16:48:56 -0400 Subject: [PATCH 2/4] Update dotnet.yml --- .github/workflows/dotnet.yml | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 5a1025e..26511da 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -8,18 +8,39 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v4 + - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 3.1.x + dotnet-version: '9.0.x' + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- + - name: Restore dependencies run: dotnet restore + - name: Build - run: dotnet build --no-restore + run: dotnet build --no-restore --configuration Release + - name: Test - run: dotnet test --no-build --verbosity normal + run: dotnet test --no-build --configuration Release --verbosity normal + + - name: Pack + run: dotnet pack --no-build --configuration Release --output ./artifacts + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: nuget-packages + path: ./artifacts/*.nupkg From 49d10df17d91b91fc8dbfee92aa07b0e14922c50 Mon Sep 17 00:00:00 2001 From: Eric Fortin Date: Wed, 23 Jul 2025 07:59:44 -0400 Subject: [PATCH 3/4] tests .net9 --- .../Applications/BridgeTests.cs | 44 ++++++++----------- .../Applications/OriginateTests.cs | 40 +++++++---------- NEventSocket.Tests/NEventSocket.Tests.csproj | 18 +++++--- NEventSocket.sln.DotSettings | 1 + 4 files changed, 47 insertions(+), 56 deletions(-) diff --git a/NEventSocket.Tests/Applications/BridgeTests.cs b/NEventSocket.Tests/Applications/BridgeTests.cs index 0b11124..4f87d4d 100644 --- a/NEventSocket.Tests/Applications/BridgeTests.cs +++ b/NEventSocket.Tests/Applications/BridgeTests.cs @@ -1,7 +1,6 @@ namespace NEventSocket.Tests.Applications { - using System.IO; - using System.Runtime.Serialization.Formatters.Binary; + using System.Text.Json; using NEventSocket.FreeSwitch; @@ -24,7 +23,6 @@ public void can_format_BridgeOptions() RingBack = "${uk-ring}" }; - // channel variables have no effect on ToString(), they're set on the a-leg of the call before initiating the bridge. // todo: allow exporting variables? options.ChannelVariables.Add("foo", "bar"); options.ChannelVariables.Add("baz", "widgets"); @@ -37,32 +35,26 @@ public void can_format_BridgeOptions() [Fact] public void can_serialize_and_deserialize_BridgeOptions() { - using (var ms = new MemoryStream()) + var options = new BridgeOptions() { - var formatter = new BinaryFormatter(); - - var options = new BridgeOptions() - { - UUID = "985cea12-4e70-4c03-8a2c-2c4b4502bbbb", - TimeoutSeconds = 20, - CallerIdName = "Dan B Leg", - CallerIdNumber = "987654321", - HangupAfterBridge = false, - IgnoreEarlyMedia = true, - ContinueOnFail = true, - RingBack = "${uk-ring}" - }; - - options.ChannelVariables.Add("foo", "bar"); - options.ChannelVariables.Add("baz", "widgets"); - - formatter.Serialize(ms, options); + UUID = "985cea12-4e70-4c03-8a2c-2c4b4502bbbb", + TimeoutSeconds = 20, + CallerIdName = "Dan B Leg", + CallerIdNumber = "987654321", + HangupAfterBridge = false, + IgnoreEarlyMedia = true, + ContinueOnFail = true, + RingBack = "${uk-ring}" + }; - ms.Seek(0, SeekOrigin.Begin); + options.ChannelVariables.Add("foo", "bar"); + options.ChannelVariables.Add("baz", "widgets"); - var fromStream = formatter.Deserialize(ms) as BridgeOptions; - Assert.Equal(options, fromStream); - } + var json = JsonSerializer.Serialize(options); + + var fromJson = JsonSerializer.Deserialize(json); + + Assert.Equal(options, fromJson); } } } \ No newline at end of file diff --git a/NEventSocket.Tests/Applications/OriginateTests.cs b/NEventSocket.Tests/Applications/OriginateTests.cs index 9a15c59..0e52dd4 100644 --- a/NEventSocket.Tests/Applications/OriginateTests.cs +++ b/NEventSocket.Tests/Applications/OriginateTests.cs @@ -1,8 +1,7 @@ namespace NEventSocket.Tests.Applications { using System.Collections.Generic; - using System.IO; - using System.Runtime.Serialization.Formatters.Binary; + using System.Text.Json; using NEventSocket.FreeSwitch; @@ -73,30 +72,23 @@ public void can_set_privacy() [Fact] public void can_serialize_and_deserialize_OriginateOptions() { - using (var ms = new MemoryStream()) - { - var formatter = new BinaryFormatter(); - var options = new OriginateOptions() - { - CallerIdName = "Dan", - CallerIdNumber = "0123457890", - ExecuteOnOriginate = "my_app::my_arg", - Retries = 5, - RetrySleepMs = 200, - ReturnRingReady = true, - TimeoutSeconds = 60, - UUID = "83fe4f3d-b957-4b26-b6bf-3879d7e21972", - IgnoreEarlyMedia = true, - }; - - formatter.Serialize(ms, options); - - ms.Seek(0, SeekOrigin.Begin); + { + CallerIdName = "Dan", + CallerIdNumber = "0123457890", + ExecuteOnOriginate = "my_app::my_arg", + Retries = 5, + RetrySleepMs = 200, + ReturnRingReady = true, + TimeoutSeconds = 60, + UUID = "83fe4f3d-b957-4b26-b6bf-3879d7e21972", + IgnoreEarlyMedia = true, + }; - var fromStream = formatter.Deserialize(ms) as OriginateOptions; - Assert.Equal(options, fromStream); - } + var json = JsonSerializer.Serialize(options); + var fromJson = JsonSerializer.Deserialize(json); + + Assert.Equal(options, fromJson); } } } \ No newline at end of file diff --git a/NEventSocket.Tests/NEventSocket.Tests.csproj b/NEventSocket.Tests/NEventSocket.Tests.csproj index 079c537..6bd9e86 100644 --- a/NEventSocket.Tests/NEventSocket.Tests.csproj +++ b/NEventSocket.Tests/NEventSocket.Tests.csproj @@ -1,17 +1,23 @@  - netcoreapp3.1 + net9.0 false - - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/NEventSocket.sln.DotSettings b/NEventSocket.sln.DotSettings index 8db27b2..dd5bffa 100644 --- a/NEventSocket.sln.DotSettings +++ b/NEventSocket.sln.DotSettings @@ -267,6 +267,7 @@ True True True + True True True True From 6171fc54957f378114e20ebda02d27eb63491589 Mon Sep 17 00:00:00 2001 From: Eric Fortin Date: Wed, 23 Jul 2025 08:02:33 -0400 Subject: [PATCH 4/4] Workflow --- .github/workflows/dotnet.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 26511da..75fcdfe 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -6,10 +6,14 @@ on: pull_request: branches: [ master ] +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + jobs: build: runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v4 @@ -34,13 +38,4 @@ jobs: run: dotnet build --no-restore --configuration Release - name: Test - run: dotnet test --no-build --configuration Release --verbosity normal - - - name: Pack - run: dotnet pack --no-build --configuration Release --output ./artifacts - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: nuget-packages - path: ./artifacts/*.nupkg + run: dotnet test --no-build --configuration Release --verbosity normal \ No newline at end of file