title: Unable to debug GetHashCode method
body: <p>I have implemented a equality comparer in below manner.</p>
  
  <pre><code>class BoxEqualityComparer : IEqualityComparer&lt;Box&gt;
  {
      public bool Equals(Box b1, Box b2)
      {
          if (b2 == null &amp;&amp; b1 == null)
             return true;
          else if (b1 == null | b2 == null)
             return false;
          else if(b1.Height == b2.Height &amp;&amp; b1.Length == b2.Length
                              &amp;&amp; b1.Width == b2.Width)
              return true;
          else
              return false;
      }
  
      public int GetHashCode(Box bx)
      {
          int hCode = bx.Height ^ bx.Length ^ bx.Width;
          return hCode.GetHashCode();
      }
  }
  </code></pre>
  
  <p>Then I have created a <code>Dictionary</code>, in that I will add some values. So here it will compare object based on it's properties (height, width, length).  I am getting the expected output.  But I am wondering about the execution of <code>GetHashCode</code> method.  <strong>I put a breakpoint in there, but I am unable to debug it.</strong>  My question is when does <code>GeHashCode</code> method will be executed and how many times?</p>
  
  <pre><code>class Example
  {
     static void Main()
     {
        BoxEqualityComparer boxEqC = new BoxEqualityComparer();
  
        var boxes = new Dictionary&lt;Box, string&gt;(boxEqC);
  
        var redBox = new Box(4, 3, 4);
        AddBox(boxes, redBox, "red");
  
        var blueBox = new Box(4, 3, 4);
        AddBox(boxes, blueBox, "blue");
  
        var greenBox = new Box(3, 4, 3);
        AddBox(boxes, greenBox, "green");
        Console.WriteLine();
  
        Console.WriteLine("The dictionary contains {0} Box objects.",
                          boxes.Count);
     }
  
     private static void AddBox(Dictionary&lt;Box, String&gt; dict, Box box, String name)
     {
        try {
           dict.Add(box, name);
        }
        catch (ArgumentException e) {
           Console.WriteLine("Unable to add {0}: {1}", box, e.Message);
        }
     }
  }
  
  public class Box
  {
      public Box(int h,  int l, int w)
      {
          this.Height = h;
          this.Length = l;
          this.Width = w;
      }
  
      public int Height { get; set; }
      public int Length { get; set; }
      public int Width { get; set; }
  
      public override String ToString()
      {
         return String.Format("({0}, {1}, {2})", Height, Length, Width);
      }
  }
  </code></pre>