From 052be850ddf6fa3dfdd15c6c47ae7b404608eae6 Mon Sep 17 00:00:00 2001 From: jericho Date: Sun, 19 Nov 2023 10:40:54 -0500 Subject: [PATCH 1/8] Upgrade nuget package references --- Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj b/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj index 97ff3f30..02c9f9cd 100644 --- a/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj +++ b/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj @@ -12,7 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all @@ -20,8 +20,8 @@ - - + + all runtime; build; native; contentfiles; analyzers From 00f10cfa4c23374e1dbd6f2795a67ec1945f0a12 Mon Sep 17 00:00:00 2001 From: jericho Date: Tue, 21 Nov 2023 10:52:20 -0500 Subject: [PATCH 2/8] Improve comment to better explain why we have to manually remove empty properties prior to serializing a JsonObject --- Source/ZoomNet/Json/JsonFormatter.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/ZoomNet/Json/JsonFormatter.cs b/Source/ZoomNet/Json/JsonFormatter.cs index 721364e1..43574ef3 100644 --- a/Source/ZoomNet/Json/JsonFormatter.cs +++ b/Source/ZoomNet/Json/JsonFormatter.cs @@ -86,10 +86,19 @@ public override void Serialize(Type type, object value, Stream stream, HttpConte { if (type == typeof(JsonObject)) { - // As of .NET 6.0, serializing a JsonObject does NOT respect 'JsonIgnoreCondition.WhenWritingNull'. - // This is a documented shortcoming that is currently considered "as designed" by the .NET team. - // See: https://github.com/dotnet/runtime/issues/54184 and https://github.com/dotnet/docs/issues/27824 - // Hopefully, this will be addressed and this workaround will no longer be necessary in .NET 7.0 + /* + When upgrading to .NET 6.0, I discovered that serializing a JsonObject does NOT respect 'JsonIgnoreCondition.WhenWritingNull'. + This is a documented shortcoming that is currently considered "as designed" by the .NET team. + See: https://github.com/dotnet/runtime/issues/54184 and https://github.com/dotnet/docs/issues/27824 + + This behavior has not changed in .NET 7.0. + + Microsoft made the decision to keep the behavior but improve the documentation to ensure developers are aware of it: + https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/use-dom#jsonnode-with-jsonserializeroptions + + That's why I wrote the following workaround which removes properties that contain a null value prior to serializing the JsonObject. + */ + var valueAsJsonObject = (JsonObject)value; var nullProperties = valueAsJsonObject .Where(kvp => kvp.Value == null) From ca7467d18af57245fbdd68e2774ddb6cab771cf5 Mon Sep 17 00:00:00 2001 From: jericho Date: Tue, 21 Nov 2023 10:58:49 -0500 Subject: [PATCH 3/8] Remove legacy "using" statement that is referencing Newtonsoft library --- Source/ZoomNet/Models/MeetingSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ZoomNet/Models/MeetingSettings.cs b/Source/ZoomNet/Models/MeetingSettings.cs index a4c29d4e..8a81cf63 100644 --- a/Source/ZoomNet/Models/MeetingSettings.cs +++ b/Source/ZoomNet/Models/MeetingSettings.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json.Converters; using System; using System.Collections.Generic; using System.Text.Json.Serialization; +using ZoomNet.Json; namespace ZoomNet.Models { From 55f1ce5de425ed0e33ef62b5c4aac4bef3c75f29 Mon Sep 17 00:00:00 2001 From: jericho Date: Tue, 21 Nov 2023 11:04:04 -0500 Subject: [PATCH 4/8] Upgrade to Cake 4.0.0 --- .config/dotnet-tools.json | 2 +- build.cake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index c33ff7cb..da200cda 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "cake.tool": { - "version": "3.2.0", + "version": "4.0.0", "commands": [ "dotnet-cake" ] diff --git a/build.cake b/build.cake index 2f01555b..104751d4 100644 --- a/build.cake +++ b/build.cake @@ -3,7 +3,7 @@ #tool dotnet:?package=coveralls.net&version=4.0.1 #tool nuget:?package=GitReleaseManager&version=0.16.0 #tool nuget:?package=ReportGenerator&version=5.2.0 -#tool nuget:?package=xunit.runner.console&version=2.6.1 +#tool nuget:?package=xunit.runner.console&version=2.6.2 #tool nuget:?package=CodecovUploader&version=0.7.1 // Install addins. From 4f57147e3df76a1e89ac0d965e0b2b07552f9bbc Mon Sep 17 00:00:00 2001 From: jericho Date: Tue, 21 Nov 2023 11:39:11 -0500 Subject: [PATCH 5/8] Remove workaround for GitVersion.Tool 5.7 --- appveyor.psm1 | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/appveyor.psm1 b/appveyor.psm1 index aa39548b..bc0febba 100644 --- a/appveyor.psm1 +++ b/appveyor.psm1 @@ -21,29 +21,8 @@ function Invoke-AppVeyorInstall { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 if ($IsLinux -or $isMacOS) { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh - - # Normally we would execute dotnet-install.sh like so: - # bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion - # - # and we would also update the PATH environment variable like so: - # $OLDPATH = [System.Environment]::GetEnvironmentVariable("PATH") - # $NEWPATH = "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$OLDPATH" - # [Environment]::SetEnvironmentVariable("PATH", "$NEWPATH") - # - # This is supposed to result in the desired .NET SDK to be installed side-by-side - # with the other version(s) of the SDK already installed. However, my experience - # on Ubuntu images in Appveyor has been that the recently installed SDK is the only - # one detected and the previous versions are no longer detected as being installed. - # - # This whole thing is problematic because GitVersion.Tool 5.7 is not compatible with - # .NET 6 (in fact, it doesn't even install) and you must have .NET 5 installed side-by-side - # with .NET 6 in order to install and use GitVersion.Tool - # - # I spent a whole day trying to find a solution but ultimately the only reliable solution - # I was able to come up with is to install in the default location (which is /usr/share/dotnet) - # using 'sudo' because you need admin privileges to access the default install location. - - sudo bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion --install-dir /usr/share/dotnet + bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion + [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") } else { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 From e4afd31036503a834c95437e056e1a92cf140495 Mon Sep 17 00:00:00 2001 From: jericho Date: Tue, 21 Nov 2023 11:56:37 -0500 Subject: [PATCH 6/8] Delay calculating the library version as much as possible during build. Hopefully this will help diagnose GitVersion.Tool problem during build on Ubuntu on AppVeyor --- build.cake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 104751d4..9c2d6498 100644 --- a/build.cake +++ b/build.cake @@ -74,8 +74,9 @@ var benchmarkProject = $"{sourceFolder}{libraryName}.Benchmark/{libraryName}.Ben var buildBranch = Context.GetBuildBranch(); var repoName = Context.GetRepoName(); -var versionInfo = GitVersion(new GitVersionSettings() { OutputType = GitVersionOutput.Json }); -var milestone = versionInfo.MajorMinorPatch; +var versionInfo = (GitVersion)null; // Will be calculated in SETUP +var milestone = string.Empty; // Will be calculated in SETUP + var cakeVersion = typeof(ICakeContext).Assembly.GetName().Version.ToString(); var isLocalBuild = BuildSystem.IsLocalBuild; var isMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", buildBranch); @@ -116,6 +117,10 @@ Setup(context => context.Log.Verbosity = Verbosity.Diagnostic; } + Information("Calculating version info..."); + versionInfo = GitVersion(new GitVersionSettings() { OutputType = GitVersionOutput.Json }); + milestone = versionInfo.MajorMinorPatch; + Information("Building version {0} of {1} ({2}, {3}) using version {4} of Cake", versionInfo.LegacySemVerPadded, libraryName, From c3ee1fe1c9d56f0ed7bfbb13327ad2bd8016a00e Mon Sep 17 00:00:00 2001 From: jericho Date: Tue, 21 Nov 2023 12:04:48 -0500 Subject: [PATCH 7/8] Restore workaround for GitVersion.Tool --- appveyor.psm1 | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/appveyor.psm1 b/appveyor.psm1 index bc0febba..aa39548b 100644 --- a/appveyor.psm1 +++ b/appveyor.psm1 @@ -21,8 +21,29 @@ function Invoke-AppVeyorInstall { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 if ($IsLinux -or $isMacOS) { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh - bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion - [System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH") + + # Normally we would execute dotnet-install.sh like so: + # bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion + # + # and we would also update the PATH environment variable like so: + # $OLDPATH = [System.Environment]::GetEnvironmentVariable("PATH") + # $NEWPATH = "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$OLDPATH" + # [Environment]::SetEnvironmentVariable("PATH", "$NEWPATH") + # + # This is supposed to result in the desired .NET SDK to be installed side-by-side + # with the other version(s) of the SDK already installed. However, my experience + # on Ubuntu images in Appveyor has been that the recently installed SDK is the only + # one detected and the previous versions are no longer detected as being installed. + # + # This whole thing is problematic because GitVersion.Tool 5.7 is not compatible with + # .NET 6 (in fact, it doesn't even install) and you must have .NET 5 installed side-by-side + # with .NET 6 in order to install and use GitVersion.Tool + # + # I spent a whole day trying to find a solution but ultimately the only reliable solution + # I was able to come up with is to install in the default location (which is /usr/share/dotnet) + # using 'sudo' because you need admin privileges to access the default install location. + + sudo bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion --install-dir /usr/share/dotnet } else { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 From 8dd671944a6c409aac2829899e20759235138ac0 Mon Sep 17 00:00:00 2001 From: jericho Date: Tue, 21 Nov 2023 12:14:39 -0500 Subject: [PATCH 8/8] Attempt to upgrade to .NET SDK 8 I previously attempted this upgrade but it broke the build on AppVeyor. Let's see if it'll work this time. --- Source/ZoomNet.IntegrationTests/ZoomNet.IntegrationTests.csproj | 2 +- Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj | 2 +- global.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/ZoomNet.IntegrationTests/ZoomNet.IntegrationTests.csproj b/Source/ZoomNet.IntegrationTests/ZoomNet.IntegrationTests.csproj index e31b6d3c..657fd7f0 100644 --- a/Source/ZoomNet.IntegrationTests/ZoomNet.IntegrationTests.csproj +++ b/Source/ZoomNet.IntegrationTests/ZoomNet.IntegrationTests.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 ZoomNet.IntegrationTests ZoomNet.IntegrationTests diff --git a/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj b/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj index 02c9f9cd..26f5e505 100644 --- a/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj +++ b/Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj @@ -1,7 +1,7 @@ - net48;net6.0;net7.0 + net48;net6.0;net7.0;net8.0 ZoomNet.UnitTests ZoomNet.UnitTests false diff --git a/global.json b/global.json index 2cc47418..8e621cac 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.404", + "version": "8.0.100", "rollForward": "patch", "allowPrerelease": false }