持久化Workflow时接收PersistenceException

时间:2009-08-12 13:02:55

标签: workflow workflow-foundation

以下是工作流持久化时获得的异常的堆栈跟踪:

System.Workflow.Runtime.Hosting.PersistenceException: Type 'System.Xml.XmlElement' in Assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. ---> System.Runtime.Serialization.SerializationException: Type 'System.Xml.XmlElement' in Assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
   at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
   at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
   at System.Workflow.ComponentModel.Activity.Save(Stream stream, IFormatter formatter)
   at System.Workflow.ComponentModel.Activity.Save(Stream stream)
   at System.Workflow.Runtime.Hosting.WorkflowPersistenceService.GetDefaultSerializedForm(Activity activity)
   at System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService.SaveWorkflowInstanceState(Activity rootActivity, Boolean unlock)
   at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
   --- End of inner exception stack trace ---
   at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
   at System.Workflow.Runtime.WorkflowExecutor.ProtectedPersist(Boolean unlock)

我如何以及在哪里调试此异常?

1 个答案:

答案 0 :(得分:2)

错误消息告诉您在顶部:

  汇编中的

'System.Xml.XmlElement'   'System.Xml,Version = 2.0.0.0,   文化=中性,   PublicKeyToken = b77a5c561934e089'是   没有标记为可序列化。

当工作流持久化时,WorkflowPersistenceService使用二进制序列化程序转储工作流中的所有数据。因此,那里的所有内容必须标记为不可序列化或必须是二进制可序列化。 XmlElement并非如此,您必须以其他方式存储数据或根本不保存数据。

相关问题