Answered Cannot persist when SendActivity faulted

  • Monday, July 20, 2009 12:05 PM
     
     
    Hi there ppl. I got a very strange problem... and others should have already discovered this but i cannot find any references to in on the web.

    My setup is: A workflow runtime starts up just one workflow that looks like this: While -> sequence with faultHandler -> SendActvity
    It tries to send to a WCF service im hosting repeatedly. In the WCF service its a fifty-fifty chance to return a MessageSecurityException or a correct message.

    The problem emerges when trying to persist between the loops when receiving a fault from the WCF-service. I´ve also had problems reusing the channel when using a SendActvity together with a ChannelManager.

    I tried to get pass the problem by manually building a proxy and calling the wcf-service and catching the exception but I got the same result..

    The exception looks like:

    Inner exception: System.Workflow.Runtime.Hosting.PersistenceException: Type 'System.ServiceModel.Channels.ReceivedFault' in Assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. ---> System.Runtime.Serialization.SerializationException: Type 'System.ServiceModel.Channels.ReceivedFault' in Assembly 'System.ServiceModel, Version=3.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.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
       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)

    I have a test-project that demonstrates my problem if needed

    Please help!

Answers

All Replies

  • Monday, July 20, 2009 1:45 PM
     
     
    found another clue - the problem is not with sendActivity or sending with wcf in wf. Its the FaultHandleActivity:s fault. First of all its not doing its job: the Fault-property is null even though the FaultType is not (so it can be dispatched to the correct faulthandler). Second of all it seems like it has an instance of the message that faulted internaly - and when the runtime is trying to persist it the fault is also attached causing the exception.

  • Monday, December 14, 2009 9:50 PM
     
     
    I have this same issue. I was able to work around it by creating a custom activity that makes my WCF call for me and then traps any errors, logs them, and then raises a different serializable error.
  • Monday, December 14, 2009 9:52 PM
     
     Answered
  • Tuesday, March 09, 2010 10:40 AM
     
     
    That sure sucks.

    Not a very good solution though with a custom activity =(
    Want to use the channelManagerService for my send and receives

    This problem occurs every time if you have a sendactivity inside a while - probably the workflow runtime tries to persist the job when executing the while while receiving an exception. Hence the problem.