Open keeleycenc opened 7 months ago
@keeleycenc please write the issue in English, so everyone can read it (w/o the use of translators of more or less good quality), and then it's way easier to be actionable on that issue. Thanks!
@gfoidl Thank you for your response and guidance! I have updated my question to English as requested and added some additional details to more accurately describe my problem and use case. Please take a look at the revised question, and I hope to receive further assistance or suggestions. Thank you again for your support and patience!
var result = await _plc.ReadStructAsync(typeof(T), db, startByteAdr);
System.StackOverflowException when using DateTime in a struct with ReadStructAsync
I'm experiencing a System.StackOverflowException with HRESULT=0x800703E9 and the message "Exception_WasThrown" when trying to include a DateTime field in a structure in an S7.Net environment. This problem occurs because I am using structs to map directly to a database schema, allowing for direct CRUD operations upon successful mapping. The struct in question has 20 fields, some of which are date fields.
Here's the problematic field in the structure:
The application only functions correctly when all DateTime fields are removed from the structure. Does the ReadStructAsync method not support reading blocks of data that include Date, Time_And_Date, or LDT time types? There is no mention of this limitation in the documentation. Additionally, the documentation states that the "read struct" and "write struct" methods do not support strings, although using the S7String attribute allows strings to be read successfully, as shown below:
However, there are no attributes available for handling time types. Could someone clarify why this is the case and whether there is a workaround for including DateTime fields in data structures read by ReadStructAsync?
And here's how I'm calling ReadStructAsync:
The library documentation does not mention limitations regarding DateTime data types, and while string types can be handled with the S7String attribute, there appears to be no equivalent for time types. I am aware of alternatives like ReadBytesAsync or ReadAsync, but using structs is preferable due to their direct mapping to the database schema.