-
Notifications
You must be signed in to change notification settings - Fork 2
Experiencing IOC initialization error for command line on Kentico 13 #25
Description
Brief bug description
What went wrong?
An IOC initialization error occurs on the Command Line branch, under some circumstances:
CMS.Core.ServiceResolutionException
HResult=0x80131500
Message=Resolution of 'CMS.Core.IAppSettingsService' failed with the following error: IoC container cannot be used for service resolution because it was not initialized yet. This means that the application was not properly pre-initialized or yet initialized. Use 'CMS.Core.Service.InitializeContainer' to perform container initialization.
Source=CMS.Core
StackTrace:
at CMS.Core.IoCContainer.ResolveTService
at CMS.Core.Service.ResolveTService
at CMS.IO.AbstractStorageProvider.CreateDefaultProvider()
at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Func`1 valueFactory)
at CMS.IO.AbstractStorageProvider.get_DefaultProvider()
at CMS.IO.File.OpenRead(String path)
at ADImport.Program.Main(String[] args) in C:\Users\adam.judd\Downloads\ADImport-master\ADImport-master\ADImport\Program.cs:line 115
This exception was originally thrown at this call stack:
CMS.Core.IoCContainer.ServiceProvider.get()
CMS.Core.IoCContainer.Resolve()
Inner Exception 1:
InvalidOperationException: IoC container cannot be used for service resolution because it was not initialized yet. This means that the application was not properly pre-initialized or yet initialized. Use 'CMS.Core.Service.InitializeContainer' to perform container initialization.
Additional context
Our resolution was to move the line (in Program.cs) that initializes the IOC for the Windows Forms to both branches:
CMSApplication.PreInit();