title: .NET The input stream is not a valid binary format tcp
body: <p>Please tell where i can have problem in my code?</p>
  <p>I serialize the data into a list of objects, then send it to the tcp server for further manipulations
  This is how serialization works:</p>
  <pre><code>var objList = new List&lt;object&gt;
  {
    path,
    attachmentContext.LogItemInfo.Attachment
  };
  
  byte[] toServer;
  BinaryFormatter bf = new BinaryFormatter();
  using (MemoryStream ms = new MemoryStream())
  {
        bf.Serialize(ms, objList);
        toServer = ms.ToArray();
  }
  
  _client.SendAsync(toServer);
  </code></pre>
  <p>So some transmissions are serialized successfully, then somewhere on the random it fails
  <a href="https://i.stack.imgur.com/vmJ4E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vmJ4E.jpg" alt="enter image description here" /></a></p>