“System.Workflow.Runtime.Hosting.PersistenceException”自定义SharePoint顺序工作流

时间:2012-03-23 14:45:20

标签: sharepoint sharepoint-workflow workflow-activity custom-activity sequential-workflow

我在具有自定义活动的SharePoint Visual Studio顺序工作流的sharepoint日志中遇到以下错误。

自定义活动是通过Component Class创建的。

我不确定为什么会出现这个错误?请帮忙!!!

System.Workflow.Runtime.Hosting.PersistenceException: Type 'System.ComponentModel.Container' in Assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. ---> System.Runtime.Serialization.SerializationException: Type 'System.ComponentModel.Container' in Assembly 'System, 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.WriteObjectInf... 3d93366f-a701-476c-91c9-d2153911486b
03/22/2012 12:38:36.31* w3wp.exe (0x049C)                           0x1620  SharePoint Foundation           Workflow Infrastructure         98d4    Unexpected  ...o.InitSerialize(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.Runtime.Hosting.WorkflowPersistenceService.GetDefaultSerializedForm(Ac...  3d93366f-a701-476c-91c9-d2153911486b
03/22/2012 12:38:36.31* w3wp.exe (0x049C)                           0x1620  SharePoint Foundation           Workflow Infrastructure         98d4    Unexpected  ...tivity activity)     at Microsoft.SharePoint.Workflow.SPWinOePersistenceService.SaveWorkflowInstanceState(Activity instanceState, 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)  3d93366f-a701-476c-91c9-d2153911486b

谢谢!

2 个答案:

答案 0 :(得分:1)

问题是因为当我将Component类更改为Sequential Activity时,我有Activity属性,例如'A'& 'B'。然后我将此活动添加到VS工具箱。在这个阶段它运作良好。

现在,当我更改活动代码以将其属性更改为“A”和& 'C'和我还删除了一个构造函数,其参数为'Container'对象。

当我重新编译此Activity并刷新其DLL时。在工作流设计器中,Activity没有刷新,即它的工具箱仍指向旧的dll。

Resolve 为此我关闭并再次打开VS,VOILA设计师现在正在使用新属性更新活动。

这是我认为VS工具箱的限制,即使dll更新该活动,它也不会刷新。

谢谢!

答案 1 :(得分:0)

您可以访问工作流程的源XAML吗?查看是否包含“Container”对象,以及是否需要将其包含在那里。如果您可以删除它并仍然正常运行工作流程,这可能会解决问题。