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

News
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.
Hedi Guizani
Hedi Guizani
what about performence? : https://www.jitbit.com/alexblog/300-systemdrawing-vs-skiasharp-benchmark/
24 February 2022
dbSoft
dbSoft
Hello Devexpress, we are working with netframework 4.8. We be able to use project convert for upgrading our project to Net 7? **All our packages and controls are only from Devexpress library**
24 February 2022
Dmitry Tok (DevExpress Support)
Dmitry Tokmachev (DevExpress)

@Hedi: Thank you for sharing this benchmark - I see results were recorded using Windows. Our products will continue using the System.Drawing library in apps that target Windows. 

With this move to SkiaSharp, our goal is to introduce the ability to use the aforementioned products on Linux\macOS. I see you are concerned about performance - we have no results right now since we have not yet tested the performance of libgdiplus and SkiaSharp on Linux. Thanks for your feedback. We will certainly take a look at this issue once we move forward with our plans.

@dbSoft: The Project Converter is helpful when you'd like to upgrade your app to use a newer version of our products. Use our Migration Tool if your task is to convert a .NET Framework project to .NET. 

@Alex: Thank you for this link, we'll look into it.

 

27 February 2022
Uwe Keim
Uwe Keim

Personally, I hate using SkiaSharp, because of its underwhelming error reporting support.

2 March 2022
Raul Rodriguez
Raul Rodriguez
Will the dependency with SkiaSharp add a lot of assemblies to the already quite big DevExpress libraries? How many megabytes are we speaking about?
3 March 2022
Vasily (DevExpress Support)
Vasily (DevExpress Support)

@Raul: Thank you for mentioning this. If your experience issues related to the deployment size of an app that uses our assemblies, create a support ticket and we'll see how we can assist you.


As for SkiaSharp: additional packages (mostly, native assets) that will be needed for macOS/Linux deployment contain multiple *.so files for all supported runtime environments. We'll see if we'll be able to offer a guidance on how to deploy required files only and will accompany our release with the necessary instructions. 

16 March 2022
Dennis Gascoigne
Dennis Gascoigne
From the comments above, am I right in saying that this will only affect apps targeting non-windows platforms, and that windows targetted apps will continue to use System.Drawing?
29 March 2022
Dmitry Tok (DevExpress Support)
Dmitry Tokmachev (DevExpress)
@Dennis: Yes, your understanding is correct.
1 April 2022
Matt91
Matt91

Any update on this?

.NET 7 is available now and we cannot update until you provide the new assemblies.


Can you provide an ETA?


Thanks

9 November 2022
Brendan Gooden
Brendan Gooden
Hi. Any update on this? .NET 7 is now been released. 
22 November 2022
pfeigl
pfeigl

Should the 22.2.2-beta already contain the SkiaSharp depedencies and thus work without libgdiplus under linux?

If yes, is there already some documentation on how to set this up within a docker container?

2 December 2022
CRM-f16b01bb-90c9-457c-ab85-7b8d1e40e95e
Customer309985
System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms.
14 March 2023

Please login or register to post comments.