Compiler Warning About PaperKind in Linux and Mac
Environment
Product | Progress® Telerik® Reporting |
OS | Linux, MacOS |
Description of the Problem
I am getting a warning in the compiler when assigning the following:
report.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;
The report
variable is of the type Telerik.Reporting.Report.
The warning appears when compiling on MacOS or Linux but not on Windows.
Cause
The Report PageSettings
properties values are from the System.Drawing.Printing namespace that is supported only on Windows starting with .NET 6.
The enumerations from the namespace, including enum PaperKind may be considered as cross-platform although they are part of the System.Drawing
as they will not throw a PlatformNotSupportedException since they don't contain any code
The reason for the warning is that the entire assembly is attributed with [assembly: SupportedOSPlatform("windows")]
- see SupportedOSPlatformAttribute.
Suggested Workaround
The warning cannot be avoided unless Microsoft decides to remove the attribute on the assembly level and add it only to the functionality that is actually not supported.