From 0b855749327a743d8804c4609ce4f1cb341ab1ce Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Tue, 15 Oct 2024 14:31:14 -0700 Subject: [PATCH] Remove DocumentSnapshotHandle --- .../Serialization/DocumentSnapshotHandle.cs | 6 ---- .../Formatters/DocumentSnapshotFormatter.cs | 35 ------------------- .../ObjectReaders.cs | 9 ----- .../ObjectWriters.cs | 10 ------ 4 files changed, 60 deletions(-) delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/DocumentSnapshotHandle.cs delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/DocumentSnapshotFormatter.cs diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/DocumentSnapshotHandle.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/DocumentSnapshotHandle.cs deleted file mode 100644 index 9b4bafb1f2..0000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/DocumentSnapshotHandle.cs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Razor.Serialization; - -internal record DocumentSnapshotHandle(string FilePath, string TargetPath, string FileKind); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/DocumentSnapshotFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/DocumentSnapshotFormatter.cs deleted file mode 100644 index 6cf7401e9d..0000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/DocumentSnapshotFormatter.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using MessagePack; - -namespace Microsoft.AspNetCore.Razor.Serialization.MessagePack.Formatters; - -internal sealed class DocumentSnapshotHandleFormatter : ValueFormatter -{ - public static readonly ValueFormatter Instance = new DocumentSnapshotHandleFormatter(); - - private DocumentSnapshotHandleFormatter() - { - } - - public override DocumentSnapshotHandle Deserialize(ref MessagePackReader reader, SerializerCachingOptions options) - { - reader.ReadArrayHeaderAndVerify(3); - - var filePath = CachedStringFormatter.Instance.Deserialize(ref reader, options).AssumeNotNull(); - var targetPath = CachedStringFormatter.Instance.Deserialize(ref reader, options).AssumeNotNull(); - var fileKind = CachedStringFormatter.Instance.Deserialize(ref reader, options).AssumeNotNull(); - - return new DocumentSnapshotHandle(filePath, targetPath, fileKind); - } - - public override void Serialize(ref MessagePackWriter writer, DocumentSnapshotHandle value, SerializerCachingOptions options) - { - writer.WriteArrayHeader(3); - - CachedStringFormatter.Instance.Serialize(ref writer, value.FilePath, options); - CachedStringFormatter.Instance.Serialize(ref writer, value.TargetPath, options); - CachedStringFormatter.Instance.Serialize(ref writer, value.FileKind, options); - } -} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs index b54d4eeb7e..c99fa76495 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs @@ -91,15 +91,6 @@ internal static partial class ObjectReaders return new(projectId, configuration, rootNamespace); } - public static DocumentSnapshotHandle ReadDocumentSnapshotHandleFromProperties(JsonDataReader reader) - { - var filePath = reader.ReadNonNullString(nameof(DocumentSnapshotHandle.FilePath)); - var targetPath = reader.ReadNonNullString(nameof(DocumentSnapshotHandle.TargetPath)); - var fileKind = reader.ReadNonNullString(nameof(DocumentSnapshotHandle.FileKind)); - - return new DocumentSnapshotHandle(filePath, targetPath, fileKind); - } - public static HostDocument ReadHostDocumentFromProperties(JsonDataReader reader) { var filePath = reader.ReadNonNullString(nameof(HostDocument.FilePath)); diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs index 21dcd2bc18..5e2850107c 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs @@ -69,16 +69,6 @@ internal static class ObjectWriters writer.WriteIfNotNull(nameof(value.RootNamespace), value.RootNamespace); } - public static void Write(JsonDataWriter writer, DocumentSnapshotHandle? value) - => writer.WriteObject(value, WriteProperties); - - public static void WriteProperties(JsonDataWriter writer, DocumentSnapshotHandle value) - { - writer.Write(nameof(value.FilePath), value.FilePath); - writer.Write(nameof(value.TargetPath), value.TargetPath); - writer.Write(nameof(value.FileKind), value.FileKind); - } - public static void Write(JsonDataWriter writer, HostDocument? value) => writer.WriteObject(value, WriteProperties);