locked
CRM 2013 Plugin Image Exception: Formatting error? RRS feed

  • Question

  • Hello CRM Experts,

      I am using CRM 2013 orion .In my plugin I want to  add an Image for Step ,while adding Image I am setting attributes for preImage while I got exception like this.

    ************** Exception Text **************
    System.ServiceModel.Dispatcher.NetDispatcherFaultException: 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:ExecuteResult. The InnerException message was 'Error in line 1 position 505673. Element 'http://schemas.microsoft.com/xrm/2011/Metadata:AttributeMetadata' contains data from a type that maps to the name 'http://schemas.microsoft.com/xrm/2013/Metadata:ImageAttributeMetadata'. 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 'ImageAttributeMetadata' and namespace 'http://schemas.microsoft.com/xrm/2013/Metadata'.'.  



    Please see InnerException for more details. ---> System.Runtime.Serialization.SerializationException: Error in line 1 position 505673. Element 'http://schemas.microsoft.com/xrm/2011/Metadata:AttributeMetadata' contains data from a type that maps to the name 'http://schemas.microsoft.com/xrm/2013/Metadata:ImageAttributeMetadata'. 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 'ImageAttributeMetadata' and namespace 'http://schemas.microsoft.com/xrm/2013/Metadata'.
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
       at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract surrogateDataContract, String name, String ns)
       at ReadArrayOfAttributeMetadataFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
       at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
       at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract surrogateDataContract, String name, String ns)
       at ReadEntityMetadataFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
       at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
       at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract surrogateDataContract, String name, String ns)
       at ReadKeyValuePairOfstringanyTypeFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
       at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
       at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract surrogateDataContract, String name, String ns)
       at ReadParameterCollectionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
       at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
       at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract surrogateDataContract, String name, String ns)
       at ReadRetrieveEntityResponseFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
       at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
       at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract surrogateDataContract, String name, String ns)
       at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
       at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
       at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
       --- End of inner exception stack trace ---

    Please any one help me thanks 

    Regards

    Murali

    Sunday, September 8, 2013 11:35 AM

Answers

  • Are you using the DLL's from the CRM 2013 SDK or are you still using CRM 2011 DLL's?

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Sunday, September 8, 2013 8:29 PM
  • You need to get the SDK from Connect, where you got the Beta downloads from.

    It is under the 'documentation' download.

    CRM 2011 DLL's may work for some operations, but it can't be guaranteed to work for everything. Best to use the CRM 2013 DLL's with CRM 2013.

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Tuesday, September 10, 2013 4:22 AM

All replies

  • Are you using the DLL's from the CRM 2013 SDK or are you still using CRM 2011 DLL's?

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Sunday, September 8, 2013 8:29 PM
  • Hi, I am using CRM 2011 DLL's ,I have no CRM 2013 sdk dlls.do you mean the dll should be from CRM 2013,if so How can I get those DLL's ,sdk is available for 2013?

    Regards

    Muralikrishna

    Tuesday, September 10, 2013 3:06 AM
  • You need to get the SDK from Connect, where you got the Beta downloads from.

    It is under the 'documentation' download.

    CRM 2011 DLL's may work for some operations, but it can't be guaranteed to work for everything. Best to use the CRM 2013 DLL's with CRM 2013.

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Tuesday, September 10, 2013 4:22 AM
  • I'm using the CRM 2013 assembly and I also have this exception,

    I'm using crm online in French with a custom action returning online a Boolean value.

    Exception is

    L'exception System.ServiceModel.FaultException n'a pas été gérée
      HResult=-2146233087
      Message=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:request. The InnerException message was 'Error in line 1 position 10278. Element 'http://schemas.microsoft.com/xrm/2011/Contracts/Services:request' contains data from a type that maps to the name 'http://schemas.microsoft.com/xrm/2011/key/:key_TriggerACustomActionRequest'. 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 'key_TriggerACustomActionRequest' and namespace 'http://schemas.microsoft.com/xrm/2011/key/'.'.  Please see InnerException for more details.
      Source=mscorlib
      Action=http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault
      StackTrace:
        Server stack trace:
           à System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
           à System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
           à System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
           à System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
        Exception rethrown at [0]:
           à System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
           à System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
           à Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request)
           à Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
           à Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Execute(OrganizationRequest request)
       
           à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           à System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    Tuesday, November 5, 2013 6:24 PM
  • I found the issue.

    You must enable proxy types with this line of code :

    proxy.EnableProxyTypes();

    Tuesday, November 5, 2013 6:31 PM