Error adding settings page in WinUI 3 MVVM app using Template Studio
TUAN THANH VO
0
Reputation points
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()
This is the problem i faced
I've tried the following steps:
- Ensured that I'm using the latest version of Template Studio.
Checked the App.xaml.cs
and theme-related files for any discrepancies.
However, the issue persists. Could someone please help me resolve this error?
Sign in to answer