Any particular reason you are putting the values in a dictionary? The way I see it, would it not be better to create a MetaData class and populate that instead? That would not mess up the deserialization and it would also make it a lot easier to query.
EDIT: Right, because of ProjectMetaDataFrom. I guess I should have read the entire question ;-)
Hi,
So this is a bug then. Problem occurs when we are deserializing the dictionary and it is static like that. Meaning it is already there. We need to fail silently here then I assume.
I have added a bug for this. We will look at it as soon as possible.
/Marcus
Ok, thanks! I forgot to mention that we are currently using version 8.0.3.411 of Find, if you need it for the bug report.
/Gustav
An item with the same key has already been added.
I'm getting this error on my production.
the Epi find version: 13.4.3
EPiServer.ContentDeliveryApi.Search 2.18.0
EPiServer.ContentDeliveryApi 2.4.0
any idea how can I fix that on my prod?
I can't replicate that on my local
Step to reproduce:
for the replication
I added a new link to the a linkitem collection area
wait for showing the autosave
nothing happened
refresh the page
page marked as published
even after the reverting the page can't edit and publish again
2021-04-27T00:39:34,Error,wgap01mstr6sdl6prod,426871,637550807746335514,0,10896,304,"EPiServer.Find.Cms.ContentEventIndexer : An exception occurred while indexing (IContent): 20739_94395. An item with the same key has already been added.. System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) at EPiServer.ContentApi.Core.Serialization.ContentModelMapperBase.Convert(IContent content, ConverterContext converterContext) at EPiServer.ContentApi.Core.Serialization.ContentConvertingService.ConvertToContentApiModel(IContent content, ConverterContext converterContext) at EPiServer.Find.DelegateValueProvider`2.GetValue(Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at EPiServer.Find.Json.CustomWriteConverterBase.WriteNonIgnoredProperty(JsonSerializer serializer, JsonProperty property, Object propertyValue, JsonWriter writer) at EPiServer.Find.Json.CustomWriteConverterBase.WriteNonIgnoredProperties(JsonWriter writer, Object value, JsonSerializer serializer) at EPiServer.Find.Cms.Json.MaxDepthContentAreaConverter.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at EPiServer.Find.Api.ActionConverterBase.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at EPiServer.Find.Json.Serializer.SerializeToTextWriter(JsonSerializer serializer, Object value, TextWriter textWriter) at EPiServer.Find.Json.Serializer.SerializeObjectsToJsonRequest(JsonSerializer serializer, IJsonRequest jsonRequest, IEnumerable values) at EPiServer.Find.Api.CommandBase`3.Execute() at EPiServer.Find.Client.IndexDirectly(IEnumerable objectsToIndex, Boolean deleteLanguageRoutingDuplicatesOnIndex) at EPiServer.Find.Client.Index(IEnumerable objectsToIndex, Boolean deleteLanguageRoutingDuplicatesOnIndex) at EPiServer.Find.Cms.ContentIndexer.IndexWithRetry(IContent[] contents, Int32 maxRetries, Boolean deleteLanguageRoutingDuplicatesOnIndex) at EPiServer.Find.Cms.ContentIndexer.Index(IEnumerable`1 contents, IndexOptions options) at EPiServer.Find.Cms.ContentEventIndexer.Index(IContent content, Boolean cascade, Func`2 cascadeFilter)",
Does anyone has any idea ?
I found this link related to that issue here but it doesn't help:
can't find a file called LinkItemCollection.cshtml nor the mentioned line
https://support.episerver.com/hc/en-us/articles/115002345291?page=1#comment_360013502551
I'm getting error when trying to add a new link to LinkItemCollection
I searched a lot but can't find any solution, seems it's a bug or internal issue in Epi
here is the Epi version I'm using:
<package id="EPiServer.AddOns.Helpers" version="0.4.0.0" targetFramework="net461" />
<package id="EPiServer.Azure" version="9.4.4" targetFramework="net461" />
<package id="EPiServer.CMS" version="11.11.2" targetFramework="net462" />
<package id="EPiServer.CMS.AspNet" version="11.20.6" targetFramework="net462" />
<package id="EPiServer.CMS.CloudSynchronization" version="1.1.1" targetFramework="net462" />
<package id="EPiServer.CMS.Core" version="11.20.6" targetFramework="net462" />
<package id="EPiServer.CMS.TinyMce" version="2.4.0" targetFramework="net462" />
<package id="EPiServer.CMS.UI" version="11.27.0" targetFramework="net462" />
<package id="EPiServer.CMS.UI.Core" version="11.27.0" targetFramework="net462" />
<package id="EPiServer.ConnectForMarketingAutomation" version="5.6.0" targetFramework="net462" />
<package id="EPiServer.ContentDeliveryApi" version="2.4.0" targetFramework="net461" />
<package id="EPiServer.ContentDeliveryApi.Cms" version="2.18.0" targetFramework="net462" />
<package id="EPiServer.ContentDeliveryApi.Core" version="2.18.0" targetFramework="net462" />
<package id="EPiServer.ContentDeliveryApi.OAuth" version="2.2.0" targetFramework="net461" />
<package id="EPiServer.ContentDeliveryApi.Search" version="2.18.0" targetFramework="net462" />
<package id="EPiServer.Find" version="13.4.3" targetFramework="net462" />
<package id="EPiServer.Find.Cms" version="13.4.3" targetFramework="net462" />
<package id="EPiServer.Find.Framework" version="13.4.3" targetFramework="net462" />
<package id="EPiServer.Forms" version="4.24.3" targetFramework="net462" />
<package id="EPiServer.Forms.Core" version="4.24.3" targetFramework="net462" />
<package id="EPiServer.Forms.Samples" version="3.5.0" targetFramework="net462" />
<package id="EPiServer.Forms.UI" version="4.24.3" targetFramework="net462" />
<package id="EPiServer.Framework" version="11.20.6" targetFramework="net462" />
<package id="EPiServer.Framework.AspNet" version="11.20.6" targetFramework="net462" />
<package id="EPiServer.GoogleAnalytics" version="2.3.2" targetFramework="net462" />
<package id="EPiServer.Insight.Cms" version="1.7.2" targetFramework="net461" />
<package id="EPiServer.Insight.UI" version="1.7.2" targetFramework="net461" />
<package id="EPiServer.InstantTemplates" version="1.0.3-beta" targetFramework="net462" />
<package id="EPiServer.Logging.Log4Net" version="2.2.2" targetFramework="net461" />
<package id="EPiServer.Marketing.Automation.Forms" version="2.3.0" targetFramework="net462" />
<package id="EPiServer.Marketing.KPI" version="2.5.4" targetFramework="net462" />
<package id="EPiServer.Marketing.Messaging" version="1.3.0" targetFramework="net461" />
<package id="EPiServer.MarketingAutomationIntegration.Salesforce" version="4.2.1" targetFramework="net462" />
<package id="EPiServer.Packaging" version="3.4.0" targetFramework="net462" />
<package id="EPiServer.Personalization.MaxMindGeolocation" version="1.0.0" targetFramework="net461" />
<package id="EPiServer.Profiles.Client" version="1.7.2" targetFramework="net461" />
<package id="EPiServer.Profiles.Client.Common" version="1.7.2" targetFramework="net461" />
<package id="EPiServer.ServiceLocation.StructureMap" version="2.0.1" targetFramework="net461" />
<package id="EPiServer.TinyMCESpellChecker" version="2.0.0" targetFramework="net462" />
<package id="EPiServer.Tracking.Cms" version="1.7.2" targetFramework="net461" />
<package id="EPiServer.Tracking.Core" version="1.7.2" targetFramework="net461" />
<package id="EPiServer.Tracking.PageView" version="1.1.0" targetFramework="net461" />
<package id="EPiServer.Turnstile.Contracts.Hmac" version="2.0.1" targetFramework="net462" />
<package id="EPiServer.VisitorGroupsCriteriaPack" version="2.0.1" targetFramework="net461" />
To me the same thing happens to me.
I have searched for @target in my entire project and have not.
since my front is with react.
This is not the solution.
@ Html.PageLink (linkItem.Text, basePage.PageLink, new {language = basePage.LanguageBranch}, new {@target = "_blank"})
any more ideas?
Hi Gustav,
While the bug is being resolved by optimizely is it possible to maybe refactor your solution to use a typedsearch with projections?
I believe this will not have the same issue or can be handled to fail gracefully.
Paul
This is my scenario:
I am using UnifiedSearchFor to search in content types together with a few custom types. For one of the custom types (Employee) I want to show some additional info in the search hit compared to a hit for e.g a standard content page.
To do this I have added the following conventions:
where the extensionmethod EmployeeMetaData looks something like this:
So far so good, the UnifiedSearchHit.MetaData contains the info I want to show. However, when I call Client.Get(id) I get: "System.ArgumentException: An item with the same key has already been added".
Stack trace:
Is this some bug or am I simply doing this the wrong way?