Closed uAinring closed 2 years ago
S7.Net Runtime Version: v4.0.30319 Version 0.14.0.0 ` public struct sDB3 { public byte start; public byte cancel; public byte ok; public byte nok; public bool masterReady;
public sDB3(byte s, byte c, byte o, byte n, bool mr) { this.start = s; this.cancel = c; this.ok = o; this.nok = n; this.masterReady = mr; } } sDB3 db3 = new sDB3((byte)0x10, (byte)0x20, (byte)0x30, (byte)0x40, false); plc.WriteStruct(db3, 3, 0);
S7.Net throws Exception: array out of bounds. at S7.Net.Types.Struct.ToBytes(Object structValue).
Hint: when I set the bool to type byte everything works fine.
bool
byte
Uwe
Initial problem was, that GefFields() somehow always returns zero. After recompilation of S7 dll issue disappeared.
S7.Net Runtime Version: v4.0.30319 Version 0.14.0.0 ` public struct sDB3 { public byte start; public byte cancel; public byte ok; public byte nok; public bool masterReady;
S7.Net throws Exception: array out of bounds. at S7.Net.Types.Struct.ToBytes(Object structValue).
Hint: when I set the
bool
to typebyte
everything works fine.Uwe