C# version of .net etc ? Missing update to C# plugin for 2020.0 / VS2019

Hi, I have started using the C# plugin and it works really nice. The debug feature is as well working really well, much better than the annoying workflow with c++ and GDB. 1: My question is about the available functions in the C# for PLCnext. What version of .net or Mono or whatever you are using is available ?. When writing the code I am missing a lot of functions for instance “BitConverter.GetBytes()” or GetRange() from a list type. I found several functions I wanted to use that are missing but i have just showed two examples. Am I just missing some references or “using xxxxxxxx” to get more features or is this a limitation in C# for PLCnext? Please help me to understand the available libraries and limits. 2: Will phoenix contact update the plugin anytime soon for 2020.0 and maybe VS2019? Will an updated plugin have an updated framework with more built-in functions?

Hi Christian, 1. PLCnext Control devices run our own version of the common language runtime, called the “embedded common language runtime”, or eCLR. As you have found, this includes a subset of the complete .NET framework. You can get more information on exactly what functions are included here: https://www.plcnext.help/te/Programming/Csharp/Csharp_Supported_functions.htm … including a link to even more information (at the bottom of that page). 2. The 2020.0 version of the plug-in should be available for download soon, and it will support VS 2019. If you are expecting that the eCLR will ever get close to the full features in .NET core, .NET standard or the .NET framework … then I am afraid that this will not happen. The eCLR is designed specifically for deterministic real-time applications, and is not intended to completely replicate those other non-realtime frameworks. If you want to write non-realtime C# applications for a PLCnext Control device using those other frameworks, then there is information in the Community on how to do that. Hopefully, some combination of these features will suit your application. ~ Martin.

Hi Martin, thank you for the answer. I am currently writing some code to send/receive serial data. Is it possible to access the Axioline modules from non-realtime C# task, and then that task can send “collected” data back to realtime control task? /Christian Veng

Hi Christian, That is an excellent question. Yes, this is possible, as follows:

                                               1. Install .NET Core on the PLC.
                                               2. [Write a C# program that targets .NET Core](/en/hn-makers-blog/456-getting-started-with-c-and-visual-studio-code-on-plcnext.html).
                                               3. Run that C# prgram as a PLCnext "extension process" (also known as an "external runtime"). This is a process that is started by the PLCnext Runtime, and can access Axioline I/O through the PLCnext Runtime's ANSI-C interface. The principle here is the same as has been demonstrated for "extension processes" written in [C++](https://github.com/PLCnext/SampleRuntime) and [Rust](https://github.com/PLCnext/rust-sample-runtime), but in this case using C#.
                                               4. In your C# program, send the collected data back to the real-time control program ... this is (currently) the tricky part.

Regarding point (4), the “simple” way to exchange data between PLCnext programs, components and processes is to use the Global Data Space. Currently, accessing the GDS directly from from extension processes requires the use of PLCnext RSC Services, which (currently) can only be accessed via C++ or Java APIs. Alternatively. your C# program could implement an OPC UA client, or a REST client, which also gives access to the GDS. We have customers who are doing similar things with C#, and we are hoping to soon publish more guidance on points (3) and (4) above. For your particular application - perhaps it is possible to achieve what you want, without using all these features. If you would like to discuss possible solutions with us directly, we’d be happy to help. You can contact us through your local Phoenix Contact subsidiary, or I can also send you my contact details (with your permission). ~ Martin.

Hello Christian, the C# Plugin is up to date and usable with Visual Studio 2019. Unfortunately someone missed to change the version number on the download page from 2019.0 LTS to 2020.0 LTS. This will be fixed soon, but the download behind is already the new version for 2020.0 LTS. - Marcel

@Martin. thanks for your reply. I think my goal can be achieved with the “simple” solution you mention at the end. Please send your contact information then I can give you a bit more info about the application/goal. @Marcel thanks for the info. I will download and try it out.