Select to view content in your preferred language

has anyone been able to serialize IdentifyResults and/or it's collection

826
3
02-17-2011 04:44 AM
SangamLama
Emerging Contributor
Hi,

I'm carrying out an IdentifyTask on the provider layer of my application. It returns a List<IdentifyResult> which needs to be passed to the SL side through my WCF service. I was looking this example,

http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2010/03/11/Sending-geometry-between-Silverlig...

and MapPoint gets serialized just as easily. But IdentifyResult doesn't.

Help?
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
What error are you getting? Are you serializing just the geometry? I'm guessing the trouble is serializing the entire Graphic, which includes Symbol.

This related thread might help: http://forums.arcgis.com/threads/8774-save-layer-to-xml-file
0 Kudos
SangamLama
Emerging Contributor
What error are you getting? Are you serializing just the geometry? I'm guessing the trouble is serializing the entire Graphic, which includes Symbol.

This related thread might help: http://forums.arcgis.com/threads/8774-save-layer-to-xml-file


The error's a bit difficult to understand to be honest. I wont copy/paste the entire strack trace here, but here's how it goes

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior
contract: Silverlight.ESRIMapping:ESRIMappingService ----> System.Runtime.Serialization.InvalidDataContractException: Type 'System.Windows.Input.TouchDevice' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types.
   at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(String message, Type type)
.....
.....

what you said does make sense. Currently, I'm trying to declare a serializable class where I have all the properties as in IdentifyResult, but skip the symbol because I don't need it here...
0 Kudos
SangamLama
Emerging Contributor
nvm. Along the way, I had been trying to serialize a map itself. How brave and stupid 😛

The error's a bit difficult to understand to be honest. I wont copy/paste the entire strack trace here, but here's how it goes

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior
contract: Silverlight.ESRIMapping:ESRIMappingService ----> System.Runtime.Serialization.InvalidDataContractException: Type 'System.Windows.Input.TouchDevice' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types.
   at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(String message, Type type)
.....
.....

what you said does make sense. Currently, I'm trying to declare a serializable class where I have all the properties as in IdentifyResult, but skip the symbol because I don't need it here...
0 Kudos