title: Not sure why I'm getting an InvalidCastException
body: <p>I am getting an <code>InvalidCastException</code> and I don't understand why.</p>
  
  <p>Here is the code that raises the exception:</p>
  
  <pre><code>public static void AddToTriedList(string recipeID)
  {
      IList&lt;string&gt; triedIDList = new ObservableCollection&lt;string&gt;();
      try
      {
          IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
          if (!settings.Contains("TriedIDList"))
          {
              settings.Add("TriedIDList", new ObservableCollection&lt;Recipe&gt;());
              settings.Save();
          }
          else
          {
              settings.TryGetValue&lt;IList&lt;string&gt;&gt;("TriedIDList", out triedIDList);
          }
          triedIDList.Add(recipeID);
          settings["TriedIDList"] = triedIDList;
          settings.Save();
      }
      catch (Exception e)
      {
          Debug.WriteLine("Exception while using IsolatedStorageSettings in AddToTriedList:");
          Debug.WriteLine(e.ToString());
      }
  }
  </code></pre>
  
  <p><strong>AppSettings.cs:</strong> (extract)</p>
  
  <pre><code>// The isolated storage key names of our settings
  const string TriedIDList_KeyName = "TriedIDList";
  
  // The default value of our settings
  IList&lt;string&gt; TriedIDList_Default = new ObservableCollection&lt;string&gt;();
  
  ...
  
  /// &lt;summary&gt;
  /// Property to get and set the TriedList Key.
  /// &lt;/summary&gt;
  public IList&lt;string&gt; TriedIDList
  {
      get
      {
          return GetValueOrDefault&lt;IList&lt;string&gt;&gt;(TriedIDList_KeyName, TriedIDList_Default);
      }
      set
      {
          if (AddOrUpdateValue(TriedIDList_KeyName, value))
          {
              Save();
          }
      }
  }
  </code></pre>
  
  <p><code>GetValueOrDefault&lt;IList&lt;string&gt;&gt;(TriedIDList_KeyName, TriedIDList_Default)</code> and <code>AddOrUpdateValue(TriedIDList_KeyName, value)</code> are the usual methods recommended by Microsoft; you can find the full code <a href="http://msdn.microsoft.com/en-us/library/ff769510%28v=vs.92%29.aspx" rel="nofollow">here</a>.</p>
  
  <p>EDIT: I got exception in this line: </p>
  
  <pre><code>settings.TryGetValue&lt;IList&lt;string&gt;&gt;("TriedIDList", out triedIDList);
  </code></pre>