I get this error when I try to add a Razor Page:
I've tried cleaning the project and even repairing Visual Studio via the installer to no avail.
Opening the indicated log, I can see at the end:
<entry>
<record>3545</record>
<time>2021/01/26 11:36:35.647</time>
<type>Error</type>
<source>Template Bootstrapper</source>
<description>Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Path '', line 1, position 25.
 at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
 at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
 at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.EnsureInstallDescriptorsLoaded()
 at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.WriteInstallDescriptorCache()
 at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save(TemplateCache cacheToSave)
 at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save()
 at Microsoft.TemplateEngine.Edge.Settings.ComponentManager.Save()
 at Microsoft.TemplateEngine.Edge.Settings.ComponentManager.RegisterMany(IEnumerable`1 typeList)
 at Microsoft.TemplateEngine.IDE.Bootstrapper.Register(Assembly assembly)
 at Microsoft.VisualStudio.TemplateEngine.Shared.Host.TemplateEngineBootstrapperFactory.TemplateEngineBoostrapper.Register(Assembly assembly)
 at Microsoft.VisualStudio.TemplateEngine.TemplateEngineHostManager.InitializeEngine()</description>
</entry>
question from:
https://stackoverflow.com/questions/65900657/an-error-was-encountered-while-initializing-templates-visual-studio-2019 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…