locked
Serialization Exception in WorkFlow 4.5 with WorkflowInstanceUnhandledExceptionRecord RRS feed

  • Question

  • Hi, I have configured my WorkFlowApplication to emit tracking records. And, in the overridden Track() method Im trying to convert the TrackingRecord to XML and storing it somewhere.

    Im able to parse all the type of Tracking Record except UnhandledExceptionRecord and FaultPropogationRecord.

    It throws SerializationException. 

    Here is my Track() method,

      protected override void Track(TrackingRecord record, TimeSpan timeout)
            {
                string _xmlData = string.Empty;
                WorkFlowTrackingEntity trackEntity = null;
                if (record != null)
                {
                    using (TextWriter textWriter = new StringWriter())
                    {
                        XmlTextWriter xmlWriter = new XmlTextWriter(textWriter);
                        DataContractSerializer serializer = new DataContractSerializer(record.GetType());
                        serializer.WriteObject(xmlWriter, record);
                        _xmlData = textWriter.ToString();
                        xmlWriter.Flush();
                        textWriter.Flush();
                    }
                    trackEntity = new WorkFlowTrackingEntity(record.InstanceId.ToString(), record.EventTime);
                    trackEntity.XMLContent = _xmlData;
                    WorkFlowTrackingHandler.GetInstance.LogTrackingRecord(trackEntity);
                }
            }

    This is how i convert the record to XML.

    Can anyone pls tell where I'm going wrong.

    Thursday, September 19, 2013 11:41 AM