DevExpress Cross-Platform Products — Getting Ready for .NET 7

24 February 2022

This blog post details our solution for the System.Drawing.Common-related breaking change in our cross-platform products. Because the number of apps deployed on non-Windows machines continues to increase, this task is a high priority for multiple development teams at DevExpress.

As you might expect, we must refactor and modify significant portions of our code for .NET 7. This is not a trivial undertaking and your feedback on this matter is very important.

What Changed

Microsoft attributed System.Drawing.Common as a Windows-specific library in .NET 6 and higher. Please visit the following page and review the Reasons for Change section for more information: System.Drawing.Common only supported on Windows.

In .NET 6, use of the System.Drawing.Common library on non-Windows operating systems produces compile-time warnings and throws TypeInitializationException and PlatformNotSupportedException exceptions. To give software developers time to migrate to more modern graphics libraries, Microsoft introduced a runtime configuration switch. You can set the System.Drawing.EnableUnixSupport option to true in the runtimeconfig.json file to enable support for non-Windows platforms and avoid runtime exceptions:

  "configProperties": {
	"System.Drawing.EnableUnixSupport": true

However, this runtime configuration switch will not be supported in .NET 7 and higher, and all apps that use Sytem.Drawing.Common APIs on non-Windows platforms will throw PlatformNotSupportedException.

Impact on Existing Apps

This breaking change affects the following DevExpress cross-platform products - components that use System.Drawing.Common as a rendering/text measurement engine:

Since it is crucial for us to maintain component functionality within all supported non-Windows environments (Linux and macOS, Azure App Service, and Docker containers), we plan to update our products in 2022 to eliminate dependence on System.Drawing.Common and implement a custom cross-platform rendering engine. We expect to complete this task by .NET 7’s official release in November 2022.

Our Plans for Upcoming Releases

We are going to introduce a new DevExpress.Drawing assembly in our v22.1 release cycle. This assembly will contain custom implementations of all System.Drawing classes not supported for non-Windows systems (Image, Font, Pen, Brush, etc.). With v22.2, we expect to release another assembly with our SkiaSharp-based cross-platform rendering engine. We researched different options, but selected SkiaSharp because it is a stable, full-featured open-source library that fully meets our requirements. Once new assemblies are available, you will need to incorporate them into your project. (If you develop a Windows-specific app, you will be able to use our Project Converter tool to upgrade your project to newer versions and add necessary assembly references/update NuGet packages).

In the second half of 2022, we also plan to revise our public API to replace System.Drawing objects with custom DevExpress.Drawing counterparts. You will need to update your code to use these new APIs.

Your Feedback Matters

As always, we welcome your feedback and look forward to your suggestions. Should you have any questions regarding rendering-related changes described in this blog post, feel free to comment below or submit a support ticket via the DevExpress Support Center. We will be happy to follow-up.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.