Exemplo n.º 1
0
        public void TestDeSerNullItem()
        {
            BrokenDeserEntity obj = new BrokenDeserEntity {
                Value = 12345
            };

            using (MemoryStream ms = new MemoryStream())
            {
                BinaryFormatter bf = new BinaryFormatter();
                bf.Serialize(ms, obj);
                ms.Position = 0;
                try
                {
                    BrokenDeserEntity clone = (BrokenDeserEntity)bf.Deserialize(ms);
                }
                catch (TargetInvocationException ex)
                {
                    if (ex.InnerException == null)
                    {
                        throw;
                    }
                    throw ex.InnerException;
                }
            }
        }
Exemplo n.º 2
0
 public void TestDeSerNullItem()
 {
     BrokenDeserEntity obj = new BrokenDeserEntity { Value = 12345 };
     using (MemoryStream ms = new MemoryStream())
     {
         BinaryFormatter bf = new BinaryFormatter();
         bf.Serialize(ms, obj);
         ms.Position = 0;
         try
         {
             BrokenDeserEntity clone = (BrokenDeserEntity)bf.Deserialize(ms);
         }
         catch (TargetInvocationException ex)
         {
             if (ex.InnerException == null) throw;
             throw ex.InnerException;
         }
     }
 }