title: Cannot add an item to a List in a constructor of a user control's base class
body: <p>I seem to be getting a null reference error when I try to add an item to a list in the constructor of my CustomCheckoutProcess class.  This class is inherited by a user control's class, so its default constructor is called when the control's constructor is called (I believe that's how it works).</p>
  
  <p>Here's the relevant parts of the class definition for the checkout process (error seems to be line 12 - marked with a comment on line 11):</p>
  
  <pre><code>public class CustomShoppingCart : ShoppingCart {
  
      private List&lt;CheckoutProcessArgument&gt; checkoutProcessArguments = List&lt;CheckoutProcessArgument&gt;();
  
      public CustomShoppingCart()
      {
          GetBaseCartSteps();
  
          CheckoutProcessArgument stepTwoArg = new CheckoutProcessArgument("Step2", new Guid("12345678-1234-1234-1234-123456789012"));
  
          // when I comment this line out, everything works fine
          checkoutProcessArguments.Add(stepTwoArg);
  
          BuildCheckoutProcess();
      }
  
      private void GetBaseCartSteps()
      {
          baseCartSteps = new Dictionary&lt;string, int&gt;();
  
          // iterate through base cart's steps and grab name/index pairs
          foreach (CheckoutProcessStepInfo step in this.CheckoutProcessSteps)
          {
              baseCartSteps.Add(step.Name, step.StepIndex);
          }
      }
  
      private bool CartContains(Guid productGuid)
      {
          for (int i = 0; i &lt; ShoppingCartInfoObj.CartItems.Count; i++)
          {
              if (ShoppingCartInfoObj.CartItems[i].SKU.SKUGUID == productGuid)
              {
                  return true;
              }
          }
  
          return false;
      }
  
      private void BuildCheckoutProcess()
      {
          // create a list of ints to dynamically add or remove the indexes of the base cart's steps
          List&lt;int&gt; steps = new List&lt;int&gt;();
  
  
          if (checkoutProcessArguments != null)
          {
              // add steps if they are specified in the arguments list
              foreach (CheckoutProcessArgument argument in checkoutProcessArguments)
              {
                  if (CartContains(argument.ProductGUID))
                  {
                      int stepIndexToAdd;
  
                      baseCartSteps.TryGetValue(argument.StepName, out stepIndexToAdd);
                      steps.Add(stepIndexToAdd);
                  }
              }
          }
  
          // sort the steps so that they'll be in the correct order
          steps.Sort();
  
          customSteps = new int[steps.Count];
  
          customSteps = steps.ToArray();
      }
  }
  </code></pre>
  
  <p>And here's the struct that I'm using to create arguments for a custom checkout process:</p>
  
  <pre><code>public struct CheckoutProcessArgument
  {
      private string stepName;
      private Guid productGUID;
  
      public string StepName { get { return stepName; } }
  
      public Guid ProductGUID { get { return productGUID; } }
  
      public CheckoutProcessArgument(string stepName, Guid productGuid)
      {
          this.stepName = stepName;
          this.productGUID = productGuid;
      }
  
  }
  </code></pre>
  
  <p>Here's the stack trace for the error I recieve:</p>
  
  <pre><code>Message: Object reference not set to an instance of an object. 
  Stack Trace: 
  at CustomShoppingCart..ctor()
  ...
  </code></pre>
  
  <p>Problem is, I can't seem to see what could possibly be null.  Any ideas?  I'm guessing the problem isn't that I'm adding something to a List in a constructor, but that I've bungled something else somewhere, but for the life of me I can't figure out what.</p>