Skip to content

Cannot add Setting Page via Template Studio to an existing page #4768

@Azzurriii

Description

@Azzurriii

Describe the bug

I'm trying to add a settings page to my existing WinUI 3 app using Template Studio (With Navigation Bar) with the MVVM pattern. However, I'm encountering the following error:

System.Exception: Error executing 'Microsoft.Templates.Core.PostActions.Catalog.Merge.MergePostAction'. Related template: ts.WinUI.MVVMToolkit.Feat.ThemeSelection. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at Microsoft.Templates.Core.PostActions.Catalog.Merge.MergeHandler.FindAndModifyContextLine(String mergeLine, Int32 diffTrivia)
   at Microsoft.Templates.Core.PostActions.Catalog.Merge.MergeHandler.Merge(IEnumerable`1 source, IEnumerable`1 merge)
   at Microsoft.Templates.Core.PostActions.Catalog.Merge.MergePostAction.ExecuteInternal()
   at Microsoft.Templates.Core.PostActions.PostAction.Execute()
   --- End of inner exception stack trace ---
   at Microsoft.Templates.Core.PostActions.PostAction.Execute()
   at Microsoft.Templates.Core.Gen.GenController.ExecutePostActions(GenInfo genInfo, ITemplateCreationResult generationResult)
   at Microsoft.Templates.Core.Gen.GenController.<GenerateItemsAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Templates.Core.Gen.NewItemGenController.<UnsafeGenerateNewItemAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Templates.UI.Services.GenerationService.<GenerateNewItemAsync>d__6.MoveNext()

Image

I've been tried:

  • Delete .vs, .bin, .obj, template studio
  • Ensure i have all the requirement SDK

Is there any one else faced this issue? And can someone fix it or its a bug?

To Reproduce

  1. Go to your existing app created by template studio
  2. click on project -> add item by template studio -> setting page -> next

Additional context

No response

Applies to the following platforms:

  • WinUI
  • WPF
  • UWP

About your setup

  • Visual Studio Version: Version 17.11.4
  • Template Studio Wizard Version: 5.5
  • Windows Build:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue relates to the wizard not working or a problem with the generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions