title: C# deserialization using reflection
body: <p>I have a .dll that deserializes a class. When I call this .dll from a project or not using reflection it works fine. When I call the .dll using reflection I get an error on the line that deserializes. I know this is due isolation that happens when I use reflection to load an assembly. Wondering if anyone has any fix or an idea of how to implement this? BTW, the serialization works just fine, it's just the deserialization that doesnt work.</p>
  
  <p>I tried both binary and xml, here's the code:</p>
  
  <pre><code>static public object SerializeLoad(string sFilename)
          {
              try
              {
                  List&lt;ElementTodo&gt; _object = null;//ElementTodo _object = null;
                  Stream stream = File.Open(sFilename, FileMode.Open);
                  //BinaryFormatter bformatter = new BinaryFormatter();
                  XmlSerializer bformatter = new XmlSerializer(typeof(ElementTodo), "ToDo");
  
                  //_object = (_object.GetType())bformatter.Deserialize(stream);
  
                  _object = (List&lt;ElementTodo&gt;)bformatter.Deserialize(stream);
                  stream.Close();
                  return _object;
              }
              catch(Exception e)
              {
                  string error = e.Message;
                  return null;
              }
          }
  </code></pre>
  
  <p>The generated XML is as follows:</p>
  
  <p>&lt;</p>
  
  <pre><code>?xml version="1.0"?&gt; 
    &lt;ArrayOfElementTodo xmlns:xsi="w3.org/2001/XMLSchema-instance"; xmlns:xsd="w3.org/2001/XMLSchema"; xmlns="ToDo"&gt; 
        &lt;ElementTodo Title="a" content="aa" isDone="false" /&gt; 
        &lt;ElementTodo Title="b" content="bb" isDone="false" /&gt; 
        &lt;ElementTodo Title="c" content="cc" isDone="false" /&gt; 
        &lt;ElementTodo Title="d" content="dd" isDone="false" /&gt; 
    &lt;/ArrayOfElementTodo&gt;
  </code></pre>