Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Changes in deserialization? ArgumentException thrown when mapping lists with only one value

Vote:
 

Experiencing an unexpected behavior after updating to Find 12.3.3 where result projection fails under some circumstances.

The page model has a property in the form of a list of strings (IEnumerable). When it has a single item the result projection throws:

EPiServer.Find.ProjectionException: An exception of type ArgumentException was thrown while projecting field MetaStandardSettingBody$$string. ---> System.ArgumentException: Argument types do not match

Adding a second item to the list will make the projection work.

Looking into the Find-index both conditions seem to be stored as arrays, yet it seems that an array with a single value won't deserialize to an array.

This will fail:

    "MetaStandardSettingBody$$string": [
        "This will fail"
    ]

This will work:

    "MetaStandardSettingBody$$string": [
        "This will ..",
        ".. work"
    ]

The projection is straight from an IEnumerable to an IEnumerable.

Anyone who have experienced similar problem?

#176250
Mar 14, 2017 14:24
Vote:
 

We are experience similar a problem. We are using Find 12.2.0.0 but the problem occured when we renewed the developer indexes, not in production or test.

An exception of type ArgumentException was thrown while projecting field EducationArea.

at System.Linq.Expressions.Expression.Constant(Object value, Type type)
at EPiServer.Find.ProjectionHelper.ReplaceExpressionWithConstantFromField(Dictionary`2 args, Expression expression)

at EPiServer.Find.ProjectionHelper.ReplaceExpressionWithConstantFromField(Dictionary`2 args, Expression expression)
at EPiServer.Find.Helpers.Linq.ExpressionVisitor.VisitMemberAssignment(MemberAssignment assignment)
at EPiServer.Find.Helpers.Linq.ExpressionVisitor.VisitBinding(MemberBinding binding)
at EPiServer.Find.Helpers.Linq.ExpressionVisitor.VisitBindingList(ReadOnlyCollection`1 original)
at EPiServer.Find.Helpers.Linq.ExpressionVisitor.VisitMemberInit(MemberInitExpression init)
at EPiServer.Find.Helpers.Linq.ExpressionVisitor.Visit(Expression exp)
at EPiServer.Find.ProjectionHelper.ReplaceMemberAssignmentsWithFieldValues(Expression selector, Dictionary`2 args)
at EPiServer.Find.ProjectionHelper.GetMappedSearchResultItem[TResult](SearchRequestBody requestBody, SearchHit`1 searchHit)
at EPiServer.Find.ProjectionHelper.GetMappedResult[TResult](SearchRequestBody requestBody, SearchResults`1 jsonResult)
at EPiServer.Find.SearchExtensions.GetProjectedResult[TResult](ISearch`1 search, SearchContext context)
at EPiServer.Find.SearchExtensions.GetResult[TResult](ISearch`1 search)
at ...

#176307
Mar 15, 2017 14:28
Vote:
 

We are having the same problems, in multiple projects and different Find versions. The problem only occurs on developer indexes(so far). 

/Peter

#176309
Mar 15, 2017 14:57
Vote:
 

Thanks for the feedback! We're also running on a newly renewed developer index, so it seems to be index related indeed.

#176313
Mar 15, 2017 15:27
Vote:
 

We have also seen this error in several projects. The error occur when adding a new property or changing index. Using any other type than string causes an exception.

#176321
Edited, Mar 16, 2017 8:03
Vote:
 

I have registered it with Episerver support

#176323
Mar 16, 2017 8:19
Vote:
 

Anyone affected by this should renew their development indices (this only affects es-eu-dev-api01.episerver.net).

/Henrik

#176349
Mar 16, 2017 15:36
Vote:
 

made new development index, and i got assigned: 

https://es-eu-dev-api01.episerver.net

and still the same problem, so how do i get my index being hosted somewhere else?

#176374
Mar 17, 2017 7:43
Vote:
 

@Henrik: I renewed the index, but that did not solve it. 

#176421
Mar 18, 2017 17:00
Vote:
 

reindexed today and it works even on: 

es-eu-dev-api01.episerver.net
#176480
Mar 20, 2017 11:55
* 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.