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

Closed

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

Activity

  1. changed the title [-][NETSDKE2E]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.[/-] [+][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.[/+] on Mar 19, 2026
  2. NicoleWang001 commented on Mar 23, 2026

    @NicoleWang001
    Member

    I also met the issue with .NET 11.0.100-preview.3.26172.107 on Fedora 43 Linux

    Image
  3. balachir commented on Mar 25, 2026

    @balachir

    @marcpopMSFT is this an issue in the .NET SDK that needs to be looked at for .NET 11 P3? From Nicole's scenario above, this reproduces when only .NET SDK is installed and even the install of VS is not necessary.

  4. transferred this issue fromdotnet/sdkon Mar 25, 2026
  5. marcpopMSFT commented on Mar 25, 2026

    @marcpopMSFT
    Member

    Moving to templating because that's where the callstack is from.

  6. marcpopMSFT commented on Mar 25, 2026

    @marcpopMSFT
    Member

    same as #10025

  7. marcpopMSFT commented on Mar 25, 2026

    @marcpopMSFT
    Member

    This will need to flow to dotnet/dotnet and get a new build before it can be tested E2E

  8. vdanche commented on Mar 26, 2026

    @vdanche
    MemberAuthor

    currently the fix is not mergered into 11.0.100-preview.3.26174.105 SDK, will verify on the new build.
    Image

  9. vdanche commented on Apr 7, 2026

    @vdanche
    MemberAuthor

    This issue is fixed on 11.0.100-preview.3.26203.107 (runtime- 11.0.0-preview.3.26203.107)

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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