Skip to content

Template creation throws an exception: dotnet new android, dotnet new maui-blazor #10025

@matouskozak

Description

@matouskozak

Product

dotnet CLI (dotnet new)

Describe The Bug

When using the latest .NET SDK and MAUI workload, we encountered an exception when creating an android sample template app.

Error: Failed to load template from D:\a\1\s\performance\CorrelationStaging\payload\dotnet\template-packs\microsoft.maui.templates.net11.11.0.0-preview.1.26160.5.nupkg(/content/templates/maui-blazor-solution/.template.config/template.json).
2026-03-19T00:07:38.5985217Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO] Details: System.ArgumentException: An item with the same key has already been added. Key: empty (Parameter 'key')
2026-03-19T00:07:38.5995938Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at System.Collections.ThrowHelper.ThrowDuplicateKey[TKey](TKey key)
2026-03-19T00:07:38.5996835Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at System.Collections.Generic.OrderedDictionary`2.TryInsert(Int32 index, TKey key, TValue value, InsertionBehavior behavior, Int32& keyIndex)
2026-03-19T00:07:38.6012459Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at System.Collections.Generic.OrderedDictionary`2.Add(TKey key, TValue value)
2026-03-19T00:07:38.6013157Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at System.Text.Json.Nodes.JsonObject.InitializeDictionary()
2026-03-19T00:07:38.6021050Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at System.Text.Json.Nodes.JsonObject.get_Count()
2026-03-19T00:07:38.6021765Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
2026-03-19T00:07:38.6030264Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
2026-03-19T00:07:38.6031717Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.ConfigModel.TemplateConfigModel..ctor(JsonObject source, ILogger logger, String baselineName)
2026-03-19T00:07:38.6032759Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.DirectoryBasedTemplate..ctor(IEngineEnvironmentSettings settings, IGenerator generator, IFile templateFile, String baselineName)
2026-03-19T00:07:38.6033692Z [2026/03/19 00:07:38][INFO]   [2026/03/19 00:07:38][INFO]    at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.RunnableProjectGenerator.GetTemplatesFromMountPointInternalAsync(IMountPoint source, CancellationToken cancellationToken)

Build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2930171&view=logs&j=5a4a2c52-3fd8-5d7a-009a-f42c0ca84580&t=fc484750-7d5f-5d47-8c70-e5b4516a9cf3

To Reproduce

Steps:

  1. Install the latest .NET SDK and MAUI workload
  2. dotnet new android --output app --name NetAndroidDefault

dotnet Info

output .NET SDK: Version: 11.0.100-preview.3.26168.106 Commit: 803eb28628 Workload version: 11.0.100-manifests.76d4304b MSBuild version: 18.6.0-preview-26168-106+803eb2862 2026-03-19T00:07:37.8244127Z [2026/03/19 00:07:37][INFO] Runtime Environment: OS Name: Windows OS Version: 10.0.20348 OS Platform: Windows RID: win-x64 Base Path: D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk\11.0.100-preview.3.26168.106\ 2026-03-19T00:07:37.8341847Z [2026/03/19 00:07:37][INFO] .NET workloads installed: [maui] Installation Source: SDK 11.0.100-preview.3 Manifest Version: 11.0.0-preview.1.26160.5/11.0.100-preview.3 Manifest Path: D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk-manifests\11.0.100-preview.3\microsoft.net.sdk.maui\11.0.0-preview.1.26160.5\WorkloadManifest.json Install Type: FileBased 2026-03-19T00:07:37.9292138Z [2026/03/19 00:07:37][INFO] [maui-windows] Installation Source: VS 17.14.37012.4 Manifest Version: 11.0.0-preview.1.26160.5/11.0.100-preview.3 Manifest Path: D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk-manifests\11.0.100-preview.3\microsoft.net.sdk.maui\11.0.0-preview.1.26160.5\WorkloadManifest.json Install Type: FileBased 2026-03-19T00:07:37.9343635Z [2026/03/19 00:07:37][INFO] [maccatalyst] Installation Source: VS 17.14.37012.4 Manifest Version: 26.2.11548-net11-p3/11.0.100-preview.3 Manifest Path: D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk-manifests\11.0.100-preview.3\microsoft.net.sdk.maccatalyst\26.2.11548-net11-p3\WorkloadManifest.json Install Type: FileBased 2026-03-19T00:07:37.9346417Z [2026/03/19 00:07:37][INFO] [ios] Installation Source: VS 17.14.37012.4 Manifest Version: 26.2.11548-net11-p3/11.0.100-preview.3 Manifest Path: D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk-manifests\11.0.100-preview.3\microsoft.net.sdk.ios\26.2.11548-net11-p3\WorkloadManifest.json Install Type: FileBased 2026-03-19T00:07:37.9349061Z [2026/03/19 00:07:37][INFO] [android] Installation Source: VS 17.14.37012.4 Manifest Version: 36.1.99-ci.main.217/11.0.100-preview.3 Manifest Path: D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk-manifests\11.0.100-preview.3\microsoft.net.sdk.android\36.1.99-ci.main.217\WorkloadManifest.json Install Type: FileBased 2026-03-19T00:07:37.9352057Z [2026/03/19 00:07:37][INFO] [wasm-tools] Installation Source: VS 17.14.37012.4 Manifest Version: 11.0.100-preview.3.26168.106/11.0.100 Manifest Path: D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk-manifests\11.0.100\microsoft.net.workload.mono.toolchain.current\11.0.100-preview.3.26168.106\WorkloadManifest.json Install Type: FileBased 2026-03-19T00:07:37.9355113Z [2026/03/19 00:07:37][INFO] Configured to use loose manifests when installing new manifests. 2026-03-19T00:07:37.9355967Z [2026/03/19 00:07:37][INFO] Host: Version: 11.0.0-preview.3.26168.106 Architecture: x64 Commit: 803eb28628 2026-03-19T00:07:37.9358105Z [2026/03/19 00:07:37][INFO] .NET SDKs installed: 11.0.100-preview.3.26168.106 [D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk] 2026-03-19T00:07:37.9359517Z [2026/03/19 00:07:37][INFO] .NET runtimes installed: Microsoft.AspNetCore.App 11.0.0-preview.3.26168.106 [D:\a\1\s\performance\CorrelationStaging\payload\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 11.0.0-preview.3.26168.106 [D:\a\1\s\performance\CorrelationStaging\payload\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 11.0.0-preview.3.26168.106 [D:\a\1\s\performance\CorrelationStaging\payload\dotnet\shared\Microsoft.WindowsDesktop.App]

Visual Studio Version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    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