S7NetPlus / s7netplus

S7.NET+ -- A .NET library to connect to Siemens Step7 devices
MIT License
1.3k stars 580 forks source link

Bug TypeHelper: count is fixed on 4 but LReal needs 8 bytes #447

Open rubend30 opened 1 year ago

rubend30 commented 1 year ago

On line:

https://github.com/S7NetPlus/s7netplus/blob/develop/S7.Net/Types/TypeHelper.cs#L18

stream.Write(converter(val), 0, 4);

Should be replaced by the actual size of the type like in the other method.

var typeSize = Marshal.SizeOf(default(T)); stream.Write(converter(val), 0, typeSize);