November Happy Hour will be moved to Thursday December 5th.

"Sequence contains more than one matching element" exception when exporting CMS pages

Vote:
 

Hello,

We are getting the exceptions below when trying to export pages from the CMS. (EPiServer.dll 7.7.1.0)

The pages work fine, i.e.: we can browse to them and they display correctly without any errors being logged.

When exporting said pages, we get these errors and the pages are not exported.

Has anyone faced the same problem in the past and does anyone have any tips on how to troubleshoot this?

2014-08-01 11:26:03,141 [22] WARN EPiServer.Core.Transfer.TransferLogger: 10.5.2 Export/import warning: [Exporting content 11451] Failed to export property MainContentArea, exception: Sequence contains more than one matching element
2014-08-01 11:26:03,141 [22] ERROR EPiServer.Core.Transfer.TransferLogger: Export/import Exception:
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at EPiServer.Core.Transfer.DependentContentTransfer.ExportDependentContent(IContent content)
at EPiServer.Core.Transfer.ContentFragmentTransfer.ExportContentFragment(ContentFragment contentFragment)
at EPiServer.Core.Transfer.PropertyContentAreaTransform.ExportEventHandler(Object sender, TransformPropertyEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at EPiServer.Core.Transfer.ContentTransfer.ExportProperties(RawContent contextContent, RawProperty[] properties, String masterLanguage)

Thanks,

Nimesh.

#88872
Aug 01, 2014 12:32
Vote:
 

When looking in code it reveals that it fails because there are a ContentAssetFolder beneath another ContentAssetFolder instance. This is not expected. ContentAssetFolder instances are only expected to be found as direct children to ContentAssetRoot folder (never nested).

If you in edit mode go to content item with id 11415 (e.g. by replacing the id parameter in the url) and there look in the block gadget and there look in folder "For this Page"/"For this block" what do you see there?? 

#88883
Aug 01, 2014 13:36
Vote:
 

Hi Johan,

I opened page 11451 and checked the blocks gadget.

The "For this page" folder is empty, it does not have any blocks (or images, if I switch to media view). 

The "MainContentArea" of the page has 2 blocks, both stored in the "For all sites" section:

1 -  For All Sites> (client name)>Sites> (country1)media>Funds overview_adviser

2 -  For All Sites> (client name)>Sites> (country2)>unstructured contentCeiling Banner

On your comment "ContentAssetFolder instances are only expected to be found as direct children to ContentAssetRoot folder (never nested).":

We are creating the asset folders programmatically in the shared blocks section (via an import service to migrate data from an external source into blocks).

Looking at the import service code, all the child folders are being created with type "ContentAssetFolder".

I'm assuming the type of the child folders should be "ContentFolder" instead?

Also I'll try changing the type of the existing folder from "ContentAssetFolder" to "ContentFolder" and see how the export goes.

Thanks for your help,

Nimesh.

#88902
Aug 01, 2014 16:13
Vote:
 

So changing the folder type from "ContentAssetFolder" to "ContentFolder" in our migration tool and updating the content type in the database for the existing migrated blocks fixed this issue.

Thanks for your help.

#88903
Aug 01, 2014 17:47
Vote:
 

Hi Johan, 

Just to double check, does this mean the "For This Page" asset folders should be of "ContentAssetFolder" and any children of "ContentFolder"?

Thanks,

Nimesh.

#88946
Aug 04, 2014 19:16
Vote:
 

Hi

Yes that is correct. 

The suggestion is to use ContentAssetHelper.GetAssetFolder method to get the asset folder for a specific content instance. 

Then if you need to create subfolders then they should be of type ContentFolder.

#88959
Aug 05, 2014 8:51
Vote:
 

Cheers, thanks you.

#88966
Aug 05, 2014 9:29
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.