Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Content Reference list property comes up empty in editor

Vote:
 

Hi

In the mid of upgradring to CMS 11 to 12.

I have a page with a IList<ContentReference> property that comes up empty in the editor, but which I know has a list of references.
Somehow 2 of the references in the list have become empty ones, is this the reason?

I get no error in the logs.

This and a couple of other pages and properties have some kind of 2-way association set up long ago, eg if you edit a certain property on one page, that change is reflected in the same property on the associated page, etc. This is all done in a publish event handler, in which I can clearly see the "old" property has values, but the newly published is empty (because the editor is saving an empty list, obviously).

So the main question, is the property loading supposed to fail completely and silently if there are empty references in a reference list? 😶

And a follow up question; is there a better way to implement this kind of associations, eg with the help of Find/Search & Navigation?

Thanks!

Update:

So, switching between versions do trigger an error in the log:

2023-10-05 10:42:52.0306|ERROR|Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware|An unhandled exception has occurred while executing the request.|System.ArgumentNullException: Value cannot be null. (Parameter 'contentLink')
   at EPiServer.Core.Internal.ContentInstanceCache.GetCacheKey(ContentReference contentLink, String language)
   at EPiServer.Core.Internal.ContentInstanceCache.TryGet(ContentReference contentLink, String language, IContent& instance)
   at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
   at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
   at EPiServer.Core.Internal.DefaultContentLoader.GetItems(IEnumerable`1 contentLinks, LoaderOptions loaderOptions)
   at EPiServer.Cms.Shell.UI.Rest.Internal.ContentStore.List(IEnumerable`1 ids)
   at lambda_method1300(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---

.........
#310089
Edited, Oct 05, 2023 7:37
Vote:
 

Could be worth having some custom validation on the publish page event to check that the list of content references are not null so that it can alert editors that the list is empty before pulishing content.

#312698
Nov 17, 2023 18:20
* 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.