From d0a036c8615709ecc038a6b7dc10c08246cb2266 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Oct 2023 12:37:15 -0400 Subject: [PATCH 1/3] - adds support for trimming --- .../Configuration/ConfigurationRoot.cs | 7 +++++++ .../IO/AuthenticationCacheManager.cs | 4 ++-- .../Microsoft.Graph.Cli.Core.csproj | 1 + src/sample/sample.csproj | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.Graph.Cli.Core/Configuration/ConfigurationRoot.cs b/src/Microsoft.Graph.Cli.Core/Configuration/ConfigurationRoot.cs index 825016c1..bed6c3ff 100644 --- a/src/Microsoft.Graph.Cli.Core/Configuration/ConfigurationRoot.cs +++ b/src/Microsoft.Graph.Cli.Core/Configuration/ConfigurationRoot.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace Microsoft.Graph.Cli.Core.Configuration; /// @@ -10,3 +12,8 @@ public class ConfigurationRoot /// public AuthenticationOptions AuthenticationOptions { get; set; } = new AuthenticationOptions(); } + +[JsonSerializable(typeof(ConfigurationRoot))] +internal partial class SourceGenerationContext : JsonSerializerContext +{ +} diff --git a/src/Microsoft.Graph.Cli.Core/IO/AuthenticationCacheManager.cs b/src/Microsoft.Graph.Cli.Core/IO/AuthenticationCacheManager.cs index e627942e..1c24eefd 100644 --- a/src/Microsoft.Graph.Cli.Core/IO/AuthenticationCacheManager.cs +++ b/src/Microsoft.Graph.Cli.Core/IO/AuthenticationCacheManager.cs @@ -174,7 +174,7 @@ private void DeleteAuthenticationRecord() try { - return await JsonSerializer.DeserializeAsync(fileStream, cancellationToken: cancellationToken); + return await JsonSerializer.DeserializeAsync(fileStream, SourceGenerationContext.Default.ConfigurationRoot, cancellationToken: cancellationToken).ConfigureAwait(false); } catch (Exception) { @@ -188,7 +188,7 @@ private async Task WriteConfigurationAsync(string path, ConfigurationRoot config try { using FileStream fileStream = File.Open(path, FileMode.Create, FileAccess.Write); - await JsonSerializer.SerializeAsync(fileStream, configuration, cancellationToken: cancellationToken); + await JsonSerializer.SerializeAsync(fileStream, configuration, SourceGenerationContext.Default.ConfigurationRoot, cancellationToken: cancellationToken).ConfigureAwait(false); } catch (DirectoryNotFoundException) { diff --git a/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj b/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj index 0e26681f..0a0f8c9b 100644 --- a/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj +++ b/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj @@ -9,6 +9,7 @@ embedded 1.0.0 preview.8 + true diff --git a/src/sample/sample.csproj b/src/sample/sample.csproj index f06b1e1f..a8c3c7d9 100644 --- a/src/sample/sample.csproj +++ b/src/sample/sample.csproj @@ -5,6 +5,7 @@ net7.0 disable enable + $(NoWarn);CS8669 @@ -20,4 +21,4 @@ - \ No newline at end of file + From d3ab1db92764d4fc8d965689dd54dace075b1f0b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 23 Oct 2023 14:24:15 -0400 Subject: [PATCH 2/3] - bumps http and abstractions dependencies --- src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj | 2 +- src/sample/sample.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj b/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj index 0a0f8c9b..617c38ef 100644 --- a/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj +++ b/src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj @@ -46,7 +46,7 @@ - + diff --git a/src/sample/sample.csproj b/src/sample/sample.csproj index a8c3c7d9..d2911204 100644 --- a/src/sample/sample.csproj +++ b/src/sample/sample.csproj @@ -11,8 +11,8 @@ - - + + From 710db54062618d624612a77422362a1a63c71305 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 23:00:08 +0000 Subject: [PATCH 3/3] Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.2 to 17.8.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.2...v17.8.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.Graph.Cli.Core.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Graph.Cli.Core.Tests/Microsoft.Graph.Cli.Core.Tests.csproj b/src/Microsoft.Graph.Cli.Core.Tests/Microsoft.Graph.Cli.Core.Tests.csproj index 4a01a512..da581353 100644 --- a/src/Microsoft.Graph.Cli.Core.Tests/Microsoft.Graph.Cli.Core.Tests.csproj +++ b/src/Microsoft.Graph.Cli.Core.Tests/Microsoft.Graph.Cli.Core.Tests.csproj @@ -11,7 +11,7 @@ - +