开启左侧

Halcon18.11 c#序列化问题

[复制链接]
schleck 发表于 2019-8-22 15:19:17 | 显示全部楼层 |阅读模式
以前在halcon12中采用c#的二进制序列化Htuple,反序列化之后得到的数据和序列化的数据是一致的,现在更新为18.11版本后,反序列化后,Htuple变量为空,有相关经验吗?

  1. serialclass c = new serialclass();
  2.             c.tuple1.Append("testdata");
  3.             using (FileStream fs = new FileStream("config.cfg", FileMode.Create))
  4.             {
  5.                 BinaryFormatter binaryFmt = new BinaryFormatter();
  6.                 fs.Seek(0, SeekOrigin.Begin);
  7.                 binaryFmt.Serialize(fs, c);
  8.             }
  9.             string restr0 = c.tuple1.S;
  10.             using (FileStream fs = new FileStream("config.cfg", FileMode.Open))
  11.             {
  12.                 fs.Seek(0, SeekOrigin.Begin);
  13.                 BinaryFormatter binaryFmt = new BinaryFormatter();
  14.                 c = (serialclass)binaryFmt.Deserialize(fs);
  15.             }
  16.             string restr = c.tuple1.S;//halcon18.11时此处报错,c.tuple1为空
复制代码
jasoncao 发表于 2020-1-6 06:53:02 | 显示全部楼层
请问解决了吗
496407151 发表于 2021-7-2 18:26:58 | 显示全部楼层
遇到了同样的问题。。。。。有解决方案吗?
yhwen0 发表于 2021-8-27 11:31:43 | 显示全部楼层
也是有存在这种问题,求解决方法
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表