From e486f38515a53230b20e5d28087c64730ae997d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 8 Mar 2023 14:29:44 +0100 Subject: [PATCH] Add type-forwarders for Xamarin.Android compatibility to System.Drawing.Common.dll (#82839) The legacy Xamarin.Android version of System.Drawing.Common.dll contained these types, add forwarders so we don't get a TypeLoadException when using an assembly compiled against that in modern .NET Android. Fixes #82829 --- .../src/CompatibilitySuppressions.xml | 147 ++++++++++++++++++++- .../src/System.Drawing.Common.Forwards.cs | 14 ++ .../src/System.Drawing.Common.csproj | 1 + 3 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 src/libraries/System.Drawing.Common/src/System.Drawing.Common.Forwards.cs diff --git a/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml b/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml index 40616c4..a20c679 100644 --- a/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml @@ -30,6 +30,151 @@ lib/netstandard2.0/System.Drawing.Common.dll lib/net462/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Color + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.KnownColor + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Point + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.PointF + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Rectangle + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.RectangleF + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Size + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.SizeF + ref/net6.0/System.Drawing.Common.dll + lib/net6.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Color + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.KnownColor + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Point + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.PointF + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Rectangle + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.RectangleF + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Size + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.SizeF + ref/net7.0/System.Drawing.Common.dll + lib/net7.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Color + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.KnownColor + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Point + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.PointF + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Rectangle + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.RectangleF + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.Size + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.SizeF + ref/net8.0/System.Drawing.Common.dll + lib/net8.0/System.Drawing.Common.dll + CP0002 F:System.Drawing.Imaging.Encoder.ColorSpace @@ -96,4 +241,4 @@ lib/netstandard2.0/System.Drawing.Common.dll lib/net462/System.Drawing.Common.dll - \ No newline at end of file + diff --git a/src/libraries/System.Drawing.Common/src/System.Drawing.Common.Forwards.cs b/src/libraries/System.Drawing.Common/src/System.Drawing.Common.Forwards.cs new file mode 100644 index 0000000..82ba631 --- /dev/null +++ b/src/libraries/System.Drawing.Common/src/System.Drawing.Common.Forwards.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// This is required for back-compatibility with legacy Xamarin which had these types in System.Drawing.Common.dll +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Color))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.ColorTranslator))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.KnownColor))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Point))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.PointF))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Rectangle))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.RectangleF))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Size))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.SizeF))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.SystemColors))] diff --git a/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj b/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj index 1d2060a..0cb66ee 100644 --- a/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj +++ b/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj @@ -30,6 +30,7 @@ Since .NET 7, non-Windows platforms are not supported, even with the runtime con + -- 2.7.4