title: Deserialization error - object reference not set
body: <p>I am trying to deserialize an xml string in c#3.5,  the code below does work in c# 4.0.
  When I try to run in the code in c#3.5 I get an <code>Object reference not set to an instance of an object</code> exception when the code tries in initialize the XmlSerializer.</p>
  
  <p>Any help would be appreciated.</p>
  
  <pre><code>string xml = "&lt;boolean xmlns=\"http://schemas.microsoft.com/2003/10/serialization/\"&gt;false&lt;/boolean&gt;";
  var xSerializer = new XmlSerializer(typeof(bool), null, null,
               new XmlRootAttribute("boolean"),
               "http://schemas.microsoft.com/2003/10/serialization/");
  
               using (var sr = new StringReader(xml))
              using (var xr = XmlReader.Create(sr))
              {
                  var y = xSerializer.Deserialize(xr);
              }
  
  System.NullReferenceException was unhandled
    Message="Object reference not set to an instance of an object."
    Source="System.Xml"
    StackTrace:
         at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace, String location, Evidence evidence)
         at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace)
         ....
         at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
  </code></pre>