title: System.NullReferenceException: Object reference not set to an instance of an object WPF
body: <p>I'm getting <code>TargetInvocationException</code> in below code. </p>
  
  <blockquote>
    <p>InnerException is "System.NullReferenceException".</p>
  </blockquote>
  
  <p>I don't understand problem here. Can anyone tell me, where could be the problem?</p>
  
  <p>C# code:</p>
  
  <pre><code>public class Harvest_Project
  {
  
      public string _name { get; set; }
      private DateTime _over_budget_notified_at;
      private bool _billable;
      private DateTime _created_at;
      private bool _active;
      private enum _bill_by { Tasks, People, none };
      public int _client_id;
      private string _code;        
      private string _notes;
      private enum _budget_by { project, project_cost, task, person, none };
      private float _budget; //Budget in hrs
      private DateTime _latest_record_at; 
      private DateTime _earliest_record_at;
      private int _fees;
      public int _id { get; set; }
      private DateTime _updated_at;
      private XmlNode _node;
  
      public int getId() { return this._id; }
  
      public Harvest_Project()
      { }
  
      public Harvest_Project(XmlNode node)
      {
          this._node = node;
          this._name = node.SelectSingleNode("name").InnerText;
          this._created_at = Harvest_Base.storeTime(node.SelectSingleNode("created-at").InnerText);
          this._updated_at = Harvest_Base.storeTime(node.SelectSingleNode("updated-at").InnerText);
          this._over_budget_notified_at = Harvest_Base.storeTime(node.SelectSingleNode("over-budget-notified-at").InnerText);
          this._latest_record_at = Harvest_Base.storeTime(node.SelectSingleNode("hint-latest-record-at").InnerText);
          this._earliest_record_at = Harvest_Base.storeTime(node.SelectSingleNode("hint-earliest-record-at").InnerText);
          this._billable = bool.Parse(node.SelectSingleNode("billable").InnerText);
          try
          {
              this._id = Convert.ToInt32(node.SelectSingleNode("id").InnerText);
              this._client_id = Convert.ToInt32(node.SelectSingleNode("client-id").InnerText);
              this._budget = float.Parse(node.SelectSingleNode("budget").InnerText);
              this._fees = Convert.ToInt32(node.SelectSingleNode("fees").InnerText);
          }
          catch (FormatException e)
          {
              Console.WriteLine("Input string is not a sequence of digits.");
          }
          catch (OverflowException e)
          {
              Console.WriteLine("The number cannot fit in an Int32.");
          }
  
          this._code = node.SelectSingleNode("code").InnerText;
          this._notes = node.SelectSingleNode("notes").InnerText;
  
          //TODO
          //_this.bill_by
          //this._budget_by
  
      }
  }
  </code></pre>
  
  <p>Exception is at line - </p>
  
  <pre><code>this._fees = Convert.ToInt32(node.SelectSingleNode("fees").InnerText);
  </code></pre>