papyrus-lang icon indicating copy to clipboard operation
papyrus-lang copied to clipboard

Duplicate INI settings cause plugin to throw exception?

Open SMB92 opened this issue 5 years ago • 5 comments

Not a critical problem by far, but I thought it curious that I received such an error due to having the bUseVersionControl setting listed twice in my CK INIs. I thought you might like to know this if you didn't already.

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.FormatException: A duplicate key 'General:bUseVersionControl' was found. at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload) at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load() at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers) at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() at DarkId.Papyrus.LanguageService.Configuration.CreationKit.CreationKitInisConfigLoader.LoadConfig(CreationKitIniLocations inis) in C:\projects\papyrus-lang\src\DarkId.Papyrus.LanguageService\Configuration\CreationKit\CreationKitInisConfigLoader.cs:line 27 at DarkId.Papyrus.LanguageService.Configuration.CreationKit.CreationKitProgramOptionsProvider.GetAmbientProgramOptions() in C:\projects\papyrus-lang\src\DarkId.Papyrus.LanguageService\Configuration\CreationKit\CreationKitProgramOptionsProvider.cs:line 43 at DarkId.Papyrus.Server.ProjectProgramOptionsProvider.<GetProgramOptions>d__7.MoveNext() in C:\projects\papyrus-lang\src\DarkId.Papyrus.Server\ProjectProgramOptionsProvider.cs:line 76 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at DarkId.Papyrus.Common.TaskExtensions.WaitForResult[T](Task`1 task) in C:\projects\papyrus-lang\src\DarkId.Papyrus.Common\TaskExtensions.cs:line 12 at DarkId.Papyrus.Server.ProjectManager.UpdateProjects(UpdateProjectsOptions options) in C:\projects\papyrus-lang\src\DarkId.Papyrus.Server\ProjectManager.cs:line 100 at DarkId.Papyrus.Server.WorkspaceManager.UpdateProjects(UpdateProjectsOptions options) in C:\projects\papyrus-lang\src\DarkId.Papyrus.Server\WorkspaceManager.cs:line 63 at DarkId.Papyrus.Server.WorkspaceManager.<>c__DisplayClass4_0.<<-ctor>b__1>d.MoveNext() in C:\projects\papyrus-lang\src\DarkId.Papyrus.Server\WorkspaceManager.cs:line 52 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state) at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() [Error - 8:15:01 pm] Connection to server got closed. Server will not be restarted.

SMB92 avatar Jun 22 '19 10:06 SMB92

I didnt know the CK would tolerate duplicate INI keys. Do you know which key the CK will take a value from? The one list before or after? Thanks for reporting. Joel will know more.

Scrivener07 avatar Jun 22 '19 10:06 Scrivener07

@SMB92 Excellent find. I'd like the parser to be resilient to this.

joelday avatar Jun 22 '19 16:06 joelday

Do you know which key the CK will take a value from? The one list before or after?

No idea, but I assume it would be the last one in the ini.

joelday avatar Jun 22 '19 16:06 joelday

I just tested it, it takes the first value and ignores the rest.

SMB92 avatar Jun 23 '19 03:06 SMB92