Binary serialization not working, not valid header
===

I got the following, not to comlex code, anyway I get an exception while deserialization.
The exception is: Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization.

But I don't get what is wrong with my code


    using System.Runtime.Serialization.Formatters.Binary;
    using System.Runtime.Serialization;
    using System.IO;

    namespace Server
    {
        [Serializable]
        class testclass
        {
            int a;
            int b;
            int c;
            public testclass()
            {
                a = 1;
                b = 2;
                c = 3000;
            }
        }
        class Program
        {
            static void Main(string[] args)
            {
                testclass test = new testclass();
                IFormatter bf = new BinaryFormatter();
                MemoryStream ms = new MemoryStream(new byte[512],0,512,true,true);
                bf.Serialize(ms,test);
                testclass detest=(testclass)bf.Deserialize(ms);
                Console.ReadLine();
            }
        }
    }