Build Error After Updating SDK Version: "Feature is not available in C# 7.3. Please use language version 9.0 or greater"

Hi Ensenso Support Team,

We are currently evaluating an upgrade from Ensenso SDK 4.1.1033 to 4.3.1037 and have encountered a build issue. We would appreciate it if anyone could clarify whether our workaround is officially supported.

Issue

When updating the Ensenso SDK from 4.1.1033 to 4.3.1037 (latest version), the following build error occurs.

Error Message

Feature ‘target-typed object creation’ is not available in C# 7.3.
Please use language version 9.0 or greater.

Error Location

NxLib.cs NxLibException()
Utf8String utf8LogMessage = new(logMessage);

(The same error occurs at multiple locations throughout the SDK.)

Development Environment

Our software is built on .NET Framework 4.8.1, and our current project configuration uses C# 7.3 by default.

Workaround

The build error can be resolved by adding the following setting to the project file and using the latest C# language version:

<LangVersion>latest</LangVersion>

Questions

  • Is this environment (.NET Framework 4.8.1 with the latest C# language version) and the above workaround officially supported by Ensenso SDK?
  • If there are any known issues or reported cases related to this configuration, could you please share them with us?

Thank you for your support.

Best Regards,
Kenzo

Hello @Kenzo,

thank you for bringing this regression to our attention. It will be fixed in the next release.

Regarding your questions:

The Ensenso SDK 4.3.x .NET interface was accidentally updated to use modern C# 9.0 features. The .NET Framework 4.8.1 runtime fully supports C# 9.0+ features - the limitation is only in the default language version that Visual Studio projects target by default.

Adding <LangVersion>latest</LangVersion> to your project file is the standard and officially supported approach for enabling newer C# language features in .NET Framework 4.8.x projects. This is Microsoft’s recommended method and should not cause any compatibility issues.

There are no known issues.

Regards,
Raphael

Hi Raphael,

It will be fixed in the next release.

Thank you for the information.

Do you have an approximate timeline for the next release?

The customer has asked me to notify them once the SDK version containing this bug fix becomes available.

Warm regards,
Kenzo

We are planning to publish a 4.3 bugfix release that incorporates a fix for this issue in the upcoming week(s).

This is fixed in version 4.3.1057, which was just released.