World is now on Opti ID! Learn more

EPiServer.Core.TypeMismatchException when adding new PropertyList

Vote:
 

We are running EPiServer CMS 12.32.3. We have serveral different PropertyLists on our site and have been using them for years. 

But now I have run into an issue where I get a TypeMismatchException that craches the site when I start it the first time after adding a new PropertyList with a new PropertyDefinitionTypePlugIn. If I restart the site after the crash everything works as expected and I can use the PropertyList as intended. Has anyone else run into this issue? Does anyone know how I can fix it?

Below is an example of the error I get on the first startup after adding a brand new PropertyList.

2025-03-20 10:32:57.671 [Error] Hosting failed to start
EPiServer.Framework.Initialization.InitializationException: Initialize action failed for Initialize on class EPiServer.Initialization.Internal.ModelSyncInitialization, EPiServer, Version=12.22.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
 ---> EPiServer.Core.TypeMismatchException: Type 'System.Collections.Generic.IList`1[[CMS.Models.Blocks.Utbildning.StudieplanversionData, CMS.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' could not be mapped to a PropertyDefinitionType
   at EPiServer.DataAbstraction.RuntimeModel.Internal.PropertyDefinitionSynchronizer.ResolveType(PropertyDefinitionModel model)
   at EPiServer.DataAbstraction.RuntimeModel.Internal.PropertyDefinitionSynchronizer.CreatePropertyDefinition(PropertyDefinitionModel model, Int32 contentTypeID)
   at EPiServer.DataAbstraction.RuntimeModel.Internal.ContentTypeModelRegister.CommitProperties(Boolean deleteUnusedTypes)
   at EPiServer.DataAbstraction.RuntimeModel.Internal.ContentTypeModelScanner.Sync(Boolean forceCommit)
   at EPiServer.Initialization.Internal.ModelSyncInitialization.Initialize(InitializationEngine context)
   at EPiServer.Framework.Initialization.Internal.ModuleNode.<>c__DisplayClass4_0.<Initialize>b__0()
   at EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key)
   at EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context)
   at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()
   --- End of inner exception stack trace ---
   at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()
   at EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions)
   at EPiServer.Framework.Initialization.InitializationEngine.Initialize()
   at EPiServer.Hosting.Internal.EPiServerFrameworkHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)

 

 

#337448
Mar 21, 2025 17:45
Vote:
 

Hello ThereseM

Some time ago, Optimizely released the Official List property. You can read more about it here:

https://world.optimizely.com/blogs/bartosz-sekula/dates/2023/1/official-list-property-support/

If the issue occurs only with new properties, it might be worth switching to this new approach—it could help resolve your problems.

#337455
Mar 22, 2025 18:21
Vote:
 

I would recommend using IList<yourtype> and yourtype inheriting from BlockData. 
You would have to write a scheduled job for migration of the content too. 

 

#337690
Apr 02, 2025 16:58
Vote:
 

Is this issue happening after migrating to CMS 12, or while working through difference versions of CMS 12 only?

We did encounter this during the upgrade, primarily because property lists weren't given GUIDs and we moved their location in code, as a refactoring effort. Unfortunately, when property lists don't have GUIDs on them, they are identified in DB using full assembly name, which includes the namespace they are in. When you move them around in code and change namespaces, it stops finding a match in DB.

The recommended approach is to always set GUID on the [PropertyDefinitionTypePlugIn] attribute, so that matches happen using GUID an dnot assembly names.

See more in depth around this here : 

https://blogs.perficient.com/2022/08/16/optimizely-cms-the-importance-of-guids-and-assembly-names/

https://blogs.perficient.com/2023/02/17/optimizely-cms-12-unique-upgrade-challenges/

 

#339424
Jun 16, 2025 20:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.