Error: Lazy loaded property value is not supported by the current property instance

Vote:
 

I'm having an error running some epi pages. 

Adding "stringDelayedLoadThreshold" to appsettings.json doesn't seem to help.

Page Does have properties with hints on "longstring", TextArea and has properties of type IList<ContentReference>.

Exception:

InvalidOperationException: Lazy loaded property value is not supported by the current property instance

Stack trace:

EPiServer.DataAccess.Internal.LazyPropertyValueLoader.SetValue(PropertyData property, PropertyDataRecord dataRecord, Func<string, Type, object> valueConverter)
EPiServer.DataAccess.Internal.ContentListDB.ReadCustomProperties(DbDataReader reader, Dictionary<int, Dictionary<int, IContent>> allFetchedItems, bool isReadingVersions)
EPiServer.DataAccess.Internal.ContentListDB.ReadPublishedList(DbCommand cmd)
EPiServer.Data.Providers.Internal.SqlDatabaseExecutor+<>c__DisplayClass24_0<TResult>.<Execute>b__0()
EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute<TResult>(Func<TResult> method)
EPiServer.DataAccess.Internal.ContentListDB.LoadSpecificContentInstances(IList<ContentReference> contentLinks, int languageBranchID)
EPiServer.Core.Internal.DefaultContentProvider.BatchLoad(IList<ContentReference> contentLinks, Func<IList<ContentReference>, IList<IContent>> dbLoader)
EPiServer.Core.Internal.DefaultContentProvider.LoadContents(IList<ContentReference> contentReferences, ILanguageSelector selector)
EPiServer.Core.ContentProvider.GetContentBatch(IList<ContentReference> batch, ILanguageSelector selector, ref List<IContent> contents, ref Dictionary<ContentReference, int> contentMap)
EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable<ContentReference> contentLinks, ILanguageSelector selector)
EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList<ContentReference> contentLinks, LoaderOptions loaderOptions)
EPiServer.Core.Internal.DefaultContentLoader.GetChildren<T>(ContentReference contentLink, LoaderOptions loaderOptions, int startIndex, int maxRows)
EPiServer.Core.Internal.DefaultContentLoader.GetChildren<T>(ContentReference contentLink, CultureInfo language)
Wilhelmsen.Web.Domain.Extensions.PageDataExtensions.GetChildrenOfType<T>(PageData pageData, IContentLoader contentLoader, CultureInfo currentCulture) in PageDataExtensions.cs

This is quite frustrating as i don't even know which property is causing issues because i cannot load the model and exception message was written by an angry girlfriend, so i have no idea what is wrong.

#293485
Dec 21, 2022 11:50
Vote:
 

This is an old post but I just ran into this error and found a solution I'd like to share.

A colleague found that when upgrading from v11 to v12, PropertyLists were crashing with little to no error messages. The solution was to convert all instances of [PropertyDefinitionTypePlugIn] to include a GUID before converting the database. The GUID should then be added to the v11 database.

I saw this error and noticed in the debug console a line that read:
"Unable to create a PropertyData instance of Type: 'MyProject.Data.Models.PoC.KeyValueItemProperty' Assembly: 'MyProject.Data'. Will fallback using the data type instead."

That KeyValueItemProperty was one of the PropertyLists that we added a GUID to, so I looked in the database.

SELECT *
FROM [MyDatabase].[dbo].[tblPropertyDefinitionType]
WHERE Name like '%KeyValueItemProperty%'

Sure enough, there were two entries for that Property Definition Type:

pkID    Property    Name    GUID    TypeName    AssemblyName    fkContentTypeGUID   DisplayName GroupName   Hidden
1000    13  KeyValueItemProperty    NULL    MyProject.Data.Models.Properties.KeyValueItemProperty   MyProject.Data  NULL    NULL    NULL    0
1223    13  KeyValueItemProperty    E05C9EF6-E538-489E-AAF4-206EB431E41B    MyProject.Data.Models.Properties.KeyValueItemProperty   MyProject.Data  NULL    NULL    NULL    0

I deleted the entry without the GUID with this command:

DELETE FROM [MyDatabase].[dbo].[tblPropertyDefinitionType]
WHERE pkID = 1000

Then I updated the tblPropertyDefinition that referenced the Property Definition Type to point to the ID that had the GUID (I guess a better solution would have been to update the previous entry with the GUID and delete the second entry.).

UPDATE [MyDatabase].[dbo].[tblPropertyDefinition]
SET fkPropertyDefinitionTypeID = 1223
WHERE fkPropertyDefinitionTypeID = 1000

After doing that, the site loaded just fine. (In full disclosure there was a second property list that had the same problem but the solution was the same.)

I highly suggest you check for all instances where the property definition type was duplicated, one with and one without the GUID, with this command. There may be property lists that don't have associated content, and that could cause a problem in the future.

SELECT *
FROM [MyDatabase].[dbo].[tblPropertyDefinitionType]
WHERE Name IN (
    SELECT Name 
    FROM [MyDatabase].[dbo].[tblPropertyDefinitionType]
    GROUP BY Name
    HAVING COUNT(Name) > 1)

Anyway, this is what solved the issue for us. I hope this works for you, and if so please mark this accepted for future visitors with this error.

Note: I'm on EPiServer.CMS 12.27.1

#326230
Edited, Jul 30, 2024 0:16
Vote:
 

Hi

That's a bit different case but good to know about it.

@devs can we please make some actual error message so we don't have to do 2 week investigation when this happens?

Let's face it, if your crash report doesn't contain ID of entry that crashed it can aswell be "oopsie, something goes wrong".

#326376
Aug 01, 2024 7:17
* 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.