From 2eeb88874493f4bf54bdad66b40103f36dbd370b Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 27 Mar 2026 14:07:46 -0500 Subject: [PATCH] Fix MockTemplateInfo for System.Text.Json serialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the Newtonsoft.Json → System.Text.Json migration (#9956), MockTemplateInfo's explicit ITemplateInfo.Tags and CacheParameters implementations throw NotImplementedException. Newtonsoft never hit these during serialization, but System.Text.Json walks all interface properties, causing TemplateDiscoveryMetadata.ToJObject() to crash in the SDK's CacheSearchCoordinatorTests. Return empty dictionaries instead of throwing. Both properties are [Obsolete] and the mock's real data lives in TagsCollection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- test/Microsoft.TemplateEngine.Mocks/MockTemplateInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.TemplateEngine.Mocks/MockTemplateInfo.cs b/test/Microsoft.TemplateEngine.Mocks/MockTemplateInfo.cs index 073b2f25524..2b8ac300691 100644 --- a/test/Microsoft.TemplateEngine.Mocks/MockTemplateInfo.cs +++ b/test/Microsoft.TemplateEngine.Mocks/MockTemplateInfo.cs @@ -92,10 +92,10 @@ public string ShortName public bool PreferDefaultName => _preferDefaultName; [Obsolete("Use ParameterDefinitionSet instead.")] - IReadOnlyDictionary ITemplateInfo.Tags => throw new NotImplementedException(); + IReadOnlyDictionary ITemplateInfo.Tags => null!; [Obsolete("Use ParameterDefinitionSet instead.")] - IReadOnlyDictionary ITemplateInfo.CacheParameters => throw new NotImplementedException(); + IReadOnlyDictionary ITemplateInfo.CacheParameters => null!; public IParameterDefinitionSet ParameterDefinitions {