How can i solve this exception,i hope get help from here,thanks
protected override WorkflowCreationContext OnGetCreationContext(object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext)
{
WorkflowCreationContext creationContext = new WorkflowCreationContext();
if (operationContext.IncomingMessageHeaders.Action.EndsWith("StartWorkflow"))
{
IDictionary<string, object> arguments = (IDictionary<string, object>)inputs[1];
if (arguments != null && arguments.Count > 0)
{
foreach (KeyValuePair<string, object> pair in arguments)
{
if (pair.Value is DTOWrapper)
{
creationContext.WorkflowArguments.Add(pair.Key, (pair.Value as DTOWrapper).Unwrap());
}
else
creationContext.WorkflowArguments.Add(pair.Key, pair.Value);
}
}
}
else
{
new Logger(_connectionString)
.Log((Guid)inputs[0], "Invalid Action: " + operationContext.IncomingMessageHeaders.Action);
}
responseContext.SendResponse(null, null);
return creationContext;
}
Class DTOWrapper:
[Serializable]
[DataContract]
public class DTOWrapper
{
public DTOWrapper();
public DTOWrapper(object obj);
[DataMember]
public string AssemblyName { get; set; }
[DataMember]
public string Data { get; set; }
[DataMember]
public string DataType { get; set; }
public object Unwrap();
}
Then throw exception:
System.ArgumentNullException was unhandled by user code
HResult=-2147467261
Message=Value cannot be null.
Parameter name: type
Source=System.Runtime.Serialization
ParamName=type
StackTrace:
at System.Runtime.Serialization.XmlObjectSerializer.CheckNull(Object obj, String name)
at System.Runtime.Serialization.DataContractSerializer.Initialize(Type type, IEnumerable`1 knownTypes, Int32 maxItemsInObjectGraph, Boolean ignoreExtensionDataObject, Boolean preserveObjectReferences, IDataContractSurrogate dataContractSurrogate, DataContractResolver dataContractResolver, Boolean serializeReadOnlyTypes)
at System.Runtime.Serialization.DataContractSerializer..ctor(Type type, IEnumerable`1 knownTypes, Int32 maxItemsInObjectGraph, Boolean ignoreExtensionDataObject, Boolean preserveObjectReferences, IDataContractSurrogate dataContractSurrogate, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer..ctor(Type type, IEnumerable`1 knownTypes, Int32 maxItemsInObjectGraph, Boolean ignoreExtensionDataObject, Boolean preserveObjectReferences, IDataContractSurrogate dataContractSurrogate)
at System.Runtime.Serialization.DataContractSerializer..ctor(Type type, IEnumerable`1 knownTypes)
at System.Runtime.Serialization.DataContractSerializer..ctor(Type type)
at Achievo.ServiceManager.ServiceModel.DTOWrapper.Deserialize(Type t, String data)
at Achievo.ServiceManager.ServiceModel.DTOWrapper.Unwrap()
at Achievo.Workflow.Runtime.WorkflowRuntimeEndpoint.OnGetCreationContext(Object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext)
at System.ServiceModel.Activities.Dispatcher.PersistenceContext.GetInstance(WorkflowGetInstanceContext parameters)
at System.ServiceModel.Activities.Dispatcher.DurableInstanceManager.GetInstanceAsyncResult.TryAcquire(Boolean fromCache)
at System.ServiceModel.Activities.Dispatcher.DurableInstanceManager.GetInstanceAsyncResult.HandleEndLoad(IAsyncResult result)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
InnerException: