Can you share code. Specially the extension method around line 157 in ContentReferenceExtension.cs (last line in your stack trace).
Have you run sql profiler and catched the stored procedure call for "CatalogContentProperty_LoadBatch"?
If you run that call against the database, what result do you get?
Line 157 is:
var items = contentLoader.GetChildren<T>(contentLink).ToList();
What we found last night and early this morning indicates that we somehow have meta fields that have culture-specific values, but they're marked as not culture-specific, so when the meta data is gathered together, Epi attempts to add multiple values for the same field to the gathered object. Still digging into how many products are in this state and how they may have gotten that way.
It is possible that your CatalogContentProperty have duplicated rows with same ObjectId, ObjectTypeId, LanguageName and MetaFieldName
This should return those duplicated rows:
select objectid, objecttypeid, languagename, metafieldname
from CatalogContentProperty
group by objectid, objecttypeid, languagename, metafieldname
having count(*) > 1
You are of course welcome to contact developer support service for further assistance
Quan, that's what we thought might be the problem too, but there aren't any actual duplicates of that kind.
I did also put in a ticket with support, but posted here because sometimes other users have found problems and solutions that the official support hasn't seen.
Quan, that's what we thought might be the problem too, but there aren't any actual duplicates of that kind.
I did also put in a ticket with support, but posted here because sometimes other users have found problems and solutions that the official support hasn't seen.
It's good that you contacted developer support service. We might need to look into your database to see what is in there ..
I also had this issue and ran this query to identify mismatches between culture specific metafields and not culture specific property values for those metafields:
SELECT
[ObjectId],
[MetaFieldName],
CCP.[MetaFieldId],
[LanguageName],
[CultureSpecific],
MF.[MultiLanguageValue]
FROM CatalogContentProperty CCP
INNER JOIN MetaField MF ON MF.MetaFieldId = CCP.MetaFieldId
where [CultureSpecific] = 0
and MF.[MultiLanguageValue] = 1
The solution was to run this query to fix the issue:
UPDATE CatalogContentProperty
SET [CultureSpecific] = 1
WHERE [CultureSpecific] = 0
AND [MetaFieldId] IN (
SELECT DISTINCT
CCP.[MetaFieldId]
FROM CatalogContentProperty CCP
INNER JOIN MetaField MF ON MF.MetaFieldId = CCP.MetaFieldId
WHERE [CultureSpecific] = 0
AND MF.[MultiLanguageValue] = 1
)
Epi version: 11.11.3.0
Commerce version: 12.17.2.0
We have some catalog categories that are throwing "An item with the same key has already been added" exceptions when we attempt to GetChildren on the category's contentLink. The categories in question work for the en-us culture, but the en-ca versions are blowing up. The <T> in question is our product interface. Our categories can have subcategories and the retrieval of those children works, but the product children causes that Epi call to fail.
Clearly, something is corrupt/misconfigured about those products, but I'm trying to figure out what it is (which will hopefully help me track down how it happened and prevent it in the future). Even if I could just know what key is duplicated, it might be helpful.
Partial stack trace (for some reason, the full one won't submit):