web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :

There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:query. The InnerException message was 'Error in line x position y. Element 'http://schemas.microsoft.com/...

Aileen Gusni Profile Picture Aileen Gusni 44,524
When you do the ConditionOperator.In in your Query during perfoming RetrieveMultiple, you might encounter this error.

“The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:query. The InnerException message was 'Error in line x position y. Element 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:anyType' contains data from a type that maps to the name 'System.Collections.Generic:List`1'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name 'List`1' and namespace 'System.Collections.Generic'.'.  Please see InnerException for more details.”

Well, here is the way how I solve this.

Root Cause

Actually, the Root Cause is because I was passing the List<object> rather than an Array, which resulted to the error.

Solution

I just change my code

From:

List<Guid> guidMyIds = new List<Guid>();
//I call the function to return list of Guid's
guidMyIds = GetGuidList();
qx.Criteria.AddCondition("guid", ConditionOperator.In, guidMyIds);
Then I change to
List<Guid> guidMyIds = new List<Guid>();
//I call the function to return list of Guid's
guidMyIds = GetGuidList();
qx.Criteria.AddCondition("guid", ConditionOperator.In, guidMyIds.ToArray());

I just change the list to array and now it works.

guidMyIds.ToArray()

Hope this helps!

Thanks!

This was originally posted here.

Comments

*This post is locked for comments