title: Failed to Create Component .. Type is not Marked as Serializable
body: <p>I'm creating a WinForms user control using Visual C# 2008 Express Edition.</p>
  
  <p>Everything was going on nicely until I found I could play with a <code>List&lt;&gt;</code> collection property from the properties window. After trying to change the collection and running the project, I started getting errors and did my best to get everything back to where it was when it was working.</p>
  
  <p>Now when I try and place an instance of the control onto a form, I get the following error.</p>
  
  <pre><code>Failed to create component 'ColorPicker'.  The error message follows:
  'System.Runtime.Serialization.SerializationException: Type 'WindowsFormsApplication1.ColorPicker+ColorData' in Assembly 'Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
     at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
     at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
     at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
     at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
     at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
    at System.Runtime.Serialization.Formatt...'
  </code></pre>
  
  <p>After dismissing this error, I start getting the following error, usually repeatedly until I use Task Manager to shut Visual C# down.</p>
  
  <pre><code>Code generation for property 'PaletteColors' failed.  Error was: 'Type 'WindowsFormsApplication1.ColorPicker+ColorData' in Assembly 'Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.'
  </code></pre>
  
  <p>I tried flagging my ColorData class as <code>[Serializable]</code> but then started getting other errors. I don't recall the exact details but it doesn't really matter because I don't want this data serialized.</p>
  
  <p>I tried a new form and got the same error. So I created a completely new project and copied my class' code over to a new user control, and the error still occurs. Can anyone suggest what might be causing this error? I do not want this collection serialized.</p>
  
  <p>Here's the collection in question (these are lines in my user control--the ColorData class is nested in my user control).</p>
  
  <pre><code>public List&lt;ColorData&gt; PaletteColors { get; set; }
  
  public class ColorData
  {
      public string Text { get; set; }
      public Color Color { get; set; }
  
      public ColorData()
      {
          Text = String.Empty;
          Color = Color.White;
      }
  
      public ColorData(string text, Color color)
      {
          Text = text;
          Color = color;
      }
  
      public ColorData(KnownColor color)
      {
          Text = Enum.GetName(typeof(KnownColor), color);
          Color = Color.FromKnownColor(color);
      }
  
      public override string ToString()
      {
          return Text;
      }
  }
  </code></pre>