Hello, 

I've created Windows workflow RuleDefinition programmatically using the CodeDom objects in the rules object model.

I've serialized into string to save it in SharePoint list, using the method below.
I've deserialized the string to get the object RuleDefinitions using the method below, it returns null and the error message: 
"Could not deserialize object. The type 'http//schemas.microsoft.com/winfx/2006/xaml/workflow.RuleDefinitions' could not be resolved."
 
 
Code
Serialize Method
DesignerSerializationManager dsm = new DesignerSerializationManager(); 
Code
using (dsm.CreateSession()){
Code
   StringBuilder stringBuilder = new StringBuilder();
Code
   using (XmlTextWriter writer = new XmlTextWriter(new System.IO.StringWriter(stringBuilder))) {
Code
      WorkflowMarkupSerializer markupSerializer = new WorkflowMarkupSerializer();
Code
      markupSerializer.Serialize(dsm, writer, ruleDeinitions);
Code
      string rulesAsString = stringBuilder.ToString();
Code
   }
Code
}
Code
Deserialize Method
Code
DesignerSerializationManager dsm = new DesignerSerializationManager(); 
using (dsm.CreateSession()){
Code
   StringBuilder stringBuilder = new StringBuilder();
Code
   using (XmlTextReader writer = new XmlTextReader(new System.IO.StringReader(xml)) ) {
Code
      reader.Read();
Code
      WorkflowMarkupSerializer markupSerializer = new WorkflowMarkupSerializer();
Code
      RuleDefinitions ruleDefinitions = markupSerializer.Deserialize(dsm, reader) as RuleDefinitions;
Code
      if (dsm.Errors.Count > 0){
Code
        WorkflowMarkupSerializationException error = dsm.Errors[0] as WorkflowMarkupSerializationException;
Code
      }
Code
Code
   }
Code
}