title: ASMX Web Service (ASP.net 2.0) - Serializable Dictionary not serialized
body: <p>All,</p>
  
  <p>I have an instance of ProjectBudget class returned from a web method.</p>
  
  <p>Ex:</p>
  
  <pre><code>[WebMethod()]
      public ProjectBudget LoadBudget(int id)
      {
         ProjectBudget  budget = BudgetManager.LoadBudget(id);
          return budget;
      }
  </code></pre>
  
  <p>The ProjectBudget class contains the following defintion:</p>
  
  <pre><code> public class ProjectBudget
  {
      public int Id = -1;
      public long VersionNumber = -1;
      public string QuoteNumber = "";
      public string CurrencyCode = "";
      public ProjectInfo Project;
      public ClientInfo Client;
  
      public readonly List&lt;InventoryItem&gt; Inventory = new List&lt;InventoryItem&gt;();
      public readonly List&lt;Staff&gt; Staff = new List&lt;Staff&gt;();
      public readonly List&lt;CodeType&gt; Departments = new List&lt;CodeType&gt;();
      public readonly SerializableDictionary&lt;string, string&gt; Tasks = new SerializableDictionary&lt;string, string&gt;();
  
      public ProjectBudget()
      {
      }
  </code></pre>
  
  <p>}</p>
  
  <p>All public fields you see are serialized just fine with the exception of Tasks field, which is completely ignored by XML serializer. Since we all know by now that Dictionaries cannot be handled by XML serializer, I use a serializable dictionary (which is just a dictionary that implements IXmlSerializable) here but XML serializer decides to ignore it completely, i.e. the XML output does not contain any tasks and the generated proxy class doesn't have this field. </p>
  
  <p>I need to figure out how to tell the XML serializer not to omit this field.</p>
  
  <p>Btw, what is interesting is that a web method that returns SerializableDictionary works fine!</p>