Newbie trying to get C# examples to work

223 views
Skip to first unread message

Isaac Sherman

unread,
Oct 28, 2021, 3:05:41 PM10/28/21
to libplctag
Hi!  I have posted this as an issue on the .NET repo before I knew about this group, so I apologize for a cross-post, but based on my browsing here this might be a better venue.  

So I'm trying to get the CSharp DotNetCore Examples to run, and I had some trouble. When I run the ListPlc I get the following exception:

Fatal error. Internal CLR error. (0x80131506)
at System.Runtime.Loader.AssemblyLoadContext..cctor()
at System.Runtime.Loader.AssemblyLoadContext.add_AssemblyResolve(System.ResolveEventHandler)
at System.Reflection.Assembly.LoadFrom(System.String)
at libplctag.NativeTagWrapper.Initialize()
at libplctag.NativeTagWrapper.InitializeIfRequired()
at libplctag.NativeTagWrapper.Read()
at libplctag.Tag.Read()
at libplctag.Tag`2[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Read()
at CSharpDotNetCore.ListPlc.Run()
at CSharpDotNetCore.Program.Main(System.String[])

I have configured the example to point at my PLC and I believe I have the path right (I'm assuming the 1 means the communication style is ethernet and the 0 means the first slot, which are both correct for my configuration). I'm using the ControlLogix type and the ab_eip protocol. I can confirm my PLC is a ControlLogix.

If I run the ExampleListTags, configured the same as the above, it times out without listing any tags. It times out in NativeTagWrapper.Initialize, throws at line 299. Any suggestions? I'd love to make this work.

Thanks!  

Isaac


Russell Dillin

unread,
Oct 28, 2021, 5:21:22 PM10/28/21
to libplctag
This sounds like the break that was urgently fixed with v2.4.2:

"The urgent fix is for tag listing. The move in 2.4.1 to use condition vars and socket waits changed internal semantics slightly and caused timeouts on all tag types that do not do an initial read. This includes listing tags, UDT tags etc."

Have you tried pinning the nuget for libplctag.NativeImport to version 1.0.19? libplctag.NavtiveImport version 1.0.20 is broken since it uses v2.4.1 (https://github.com/libplctag/libplctag.NET/commit/0425634bd0796b104ed80c76eb73fef9ac4cae0c).

Kyle

unread,
Oct 28, 2021, 8:16:40 PM10/28/21
to libplctag
Tim just updated the .Net library.  It includes the new core DLL (version 2.4.2).  I am not sure how long it takes to get to Nuget.

Best,
Kyle

Isaac Sherman

unread,
Oct 29, 2021, 8:35:52 AM10/29/21
to libplctag
It works!  I just pulled from the Git repo and it works just fine.  Thanks all, I'll close my issue and switch over to using the nuget package, once I see the new version, for my other project.
Reply all
Reply to author
Forward
0 new messages