Skip to content

[NETSDKE2E][Regression]Error: Failed to load template from "C:\xxx\microsoft.maui.templates.net10.10.0.20.nupkg(/content/templates/maui-blazor-solution/.template.config/template.json)" displays when running command in CLI for the first time. #10047

@vdanche

Description

@vdanche

RGRESSION INFO
not repro on VS 18.6 Insiders [11617.261.main] + 11.0.100-preview.3.26166.111 (runtime- 11.0.0-preview.3.26166.111)
not repro in CLI when only installed Insiders VS 18.6 [11618.325.main]

INSTALL STEPS

Insiders VS 18.6 [11618.325.main] + 11.0.100-preview.3.26168.106 (runtime- 11.0.100-preview.3.26168.106) on win-x64

REPRO STEPS
1.In CLI, run the dotnet command for the first time, e.g dotnet new sln

ACTUAL
sln is created successfully,but below error happens
Image
Error: Failed to load template from "C:\Program Files\dotnet\template-packs\microsoft.maui.templates.net10.10.0.20.nupkg(/content/templates/maui-blazor-solution/.template.config/template.json)".
Details: System.ArgumentException: An item with the same key has already been added. Key: empty (Parameter 'key')
at System.Collections.ThrowHelper.ThrowDuplicateKey[TKey](TKey key)
at System.Collections.Generic.OrderedDictionary2.TryInsert(Int32 index, TKey key, TValue value, InsertionBehavior behavior, Int32& keyIndex) at System.Collections.Generic.OrderedDictionary2.Add(TKey key, TValue value)
at System.Text.Json.Nodes.JsonObject.InitializeDictionary()
at System.Text.Json.Nodes.JsonObject.get_Count()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.ConfigModel.TemplateConfigModel..ctor(JsonObject source, ILogger logger, String baselineName) at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.DirectoryBasedTemplate..ctor(IEngineEnvironmentSettings settings, IGenerator generator, IFile templateFile, String baselineName) at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.RunnableProjectGenerator.GetTemplatesFromMountPointInternalAsync(IMountPoint source, CancellationToken cancellationToken) Error: Failed to load template from "C:\Program Files\dotnet\template-packs\microsoft.maui.templates.net10.10.0.20.nupkg(/content/templates/maui-blazor/.template.config/template.json)". Details: System.ArgumentException: An item with the same key has already been added. Key: empty (Parameter 'key') at System.Collections.ThrowHelper.ThrowDuplicateKey[TKey](TKey key) at System.Collections.Generic.OrderedDictionary2.TryInsert(Int32 index, TKey key, TValue value, InsertionBehavior behavior, Int32& keyIndex)
at System.Collections.Generic.OrderedDictionary2.Add(TKey key, TValue value) at System.Text.Json.Nodes.JsonObject.InitializeDictionary() at System.Text.Json.Nodes.JsonObject.get_Count() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.ConfigModel.TemplateConfigModel..ctor(JsonObject source, ILogger logger, String baselineName)
at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.DirectoryBasedTemplate..ctor(IEngineEnvironmentSettings settings, IGenerator generator, IFile templateFile, String baselineName)
at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.RunnableProjectGenerator.GetTemplatesFromMountPointInternalAsync(IMountPoint source, CancellationToken cancellationToken)

Expected Result:
sln is created successfully without any erros

Note:
1.We don't meet it in CLI when only installing SDK
2.it not happens when running command in CLI for the second time

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions