Currently the latest version of DataMiner supports C# 7.3. When will it support C# 8.0 and 9.0?
Hi Toon, I want to use this in Automation Scripts and Protocol QActions.
I'm going to assume you are talking about using new C# features in driver scripts, which runs in the SLManagedScripting process if I recall correctly.
In previous versions of C#, many of the features were simply "syntactic sugar", meaning the only thing you required was a compiler (Roslyn) update, and you were good to go. It didn't really matter if you were on .NET 4.5 or 4.6 or other framework versions.
Unfortunately, starting with the features in C# 8.0, they are now also tied to the underlying framework. For C# 8.0 this is now .NET Core 3.0 (or more likely it's successor .NET 5). This means that we cannot simply update the Roslyn compiler used to compile scripts anymore. Writing code in C# 8.0 will never run on the .NET framework.
We will first need to target .NET Core 3.0 or higher. This is not going to be an easy process since a lot of the windows-only technologies that we are using today (COM, WCF, .NET Remoting, Win32 API calls) are windows only and not supported on .NET Core.
It's unfortunate that C# 8.0 features cannot be used right now but we will get there eventually 🙂
Not all, but some features of C#8 and C#9 don’t need .Net Core. For the Cube projects, we’re currently moving to C#9 with .Net Framework.
A (not-complete) list of features that work with .Net Framework:
Record types
Init-only setters
Pattern matching enhancements
Target-typed new expressions
Target-typed conditional expressions
Using declarations
Null-coalescing assignment (x ??= y; instead of x = x ?? y;)
@$”…”
That’s a very interesting remark Lander, are you using a nuget package for this?
For most features you don’t need to add anything, just change the langversion to 9.0.
To use ValueTuple you need the System.ValueTuple dll and for records you need to add one (empty) type in your code base.
See http://devcore3/review/#/c/44759/ for the changes we did in the Cube projects.
What area of DataMiner are you talking about exactly? The versions you mention are C# language versions and are only relevant when coding. The only parts I know of in DataMiner where you can insert actual C# code are Automation scripts and Protocol QActions. Are those the ones you’re referring to?