Beckhoff / TF6000_ADS_DOTNET_V5_Samples

Sample code for the Version 6.X series of the TwinCAT ADS .NET Packages
https://infosys.beckhoff.com/content/1033/tc3_ads.net/9407515403.html?id=6770980177009971601
BSD Zero Clause License
37 stars 15 forks source link

IValueAnySymbol.WriteAnyValue method throws Exception #8

Closed maxxie85 closed 2 years ago

maxxie85 commented 2 years ago

If working with a struct on a IValueAnySymbol. When you call WriteAnyValue on that instance you will get an System.ArgumentException with the message Struct member not found! (Parameter 'type')

I believe there is a bug in the latest ADS version for .Net (current used 5.0.545)

Because when I write the same struct with the WriteAny method from the IAdsConnection interface it doesn't throw an exception. I created a small demo application to illustrate the problem with an .net console project and a TwinCAT PLC project DemoApplication.zip .

RalfHeitmann commented 2 years ago

There is an issue in the WriteAny implementation to marshal .NET predefined structs that could be located with the help of your Sample. Thx @maxxie85. The upcoming releases of Beckhoff.TwinCAT.Ads packages will fix this problem.

maxxie85 commented 2 years ago

Thanks for the response, looking forward to the fix.