Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround broken Mono System.Drawing facades #82829

Closed
filipnavara opened this issue Mar 1, 2023 · 1 comment · Fixed by #82839
Closed

Workaround broken Mono System.Drawing facades #82829

filipnavara opened this issue Mar 1, 2023 · 1 comment · Fixed by #82839
Assignees
Milestone

Comments

@filipnavara
Copy link
Member

Legacy Mono had incorrect facades for some System.Drawing types. This was an effect of System.Drawing being the implementation assembly and System.Drawing.Primitives/Common being the type forwarders. Due to the Mono SDK bugs many NuGets for MonoAndroid/Xamarin.iOS incorrectly expects the following types to be present in System.Drawing.Common:

  • System.Drawing.Color
  • System.Drawing.KnownColor
  • System.Drawing.Point
  • System.Drawing.PointF
  • System.Drawing.Rectangle
  • System.Drawing.RectangleF
  • System.Drawing.Size
  • System.Drawing.SizeF

PR #82618 solved a similar problem for mscorlib. We should consider adding the type forwarders from System.Drawing.Common to System.Drawing.Primitives to offer compatibility for MonoAndroid assemblies.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Mar 1, 2023
@ghost
Copy link

ghost commented Mar 1, 2023

Tagging subscribers to this area: @dotnet/area-system-drawing
See info in area-owners.md if you want to be subscribed.

Issue Details

Legacy Mono had incorrect facades for some System.Drawing types. This was an effect of System.Drawing being the implementation assembly and System.Drawing.Primitives/Common being the type forwarders. Due to the Mono SDK bugs many NuGets for MonoAndroid/Xamarin.iOS incorrectly expects the following types to be present in System.Drawing.Common:

  • System.Drawing.Color
  • System.Drawing.KnownColor
  • System.Drawing.Point
  • System.Drawing.PointF
  • System.Drawing.Rectangle
  • System.Drawing.RectangleF
  • System.Drawing.Size
  • System.Drawing.SizeF

PR #82618 solved a similar problem for mscorlib. We should consider adding the type forwarders from System.Drawing.Common to System.Drawing.Primitives to offer compatibility for MonoAndroid assemblies.

Author: filipnavara
Assignees: -
Labels:

area-System.Drawing

Milestone: -

akoeplinger added a commit to akoeplinger/runtime that referenced this issue Mar 1, 2023
…ng.Common.dll

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 dotnet#82829
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 1, 2023
@akoeplinger akoeplinger added this to the 8.0.0 milestone Mar 1, 2023
@akoeplinger akoeplinger removed the untriaged New issue has not been triaged by the area owner label Mar 1, 2023
@akoeplinger akoeplinger self-assigned this Mar 1, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 8, 2023
akoeplinger added a commit that referenced this issue Mar 8, 2023
…ng.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
akoeplinger added a commit to akoeplinger/runtime that referenced this issue Mar 8, 2023
…ng.Common.dll (dotnet#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 dotnet#82829

(cherry picked from commit e486f38)
carlossanlop added a commit that referenced this issue Mar 9, 2023
…ity to mscorlib.dll and System.Drawing.Common.dll (#83137)

* Add more type-forwarders for Xamarin.Android compatibility to mscorlib.dll (#82618)

The legacy Xamarin.Android version of mscorlib.dll differed a bit compared to the .NET Framework mscorlib.dll, mostly because of additions for .NET Standard 2.1 support.

This meant that an assembly which was compiled against that mscorlib expects types there but since we didn't have type-forwarders in our mscorlib.dll shim to point them to the right assembly you'd get a TypeLoadException when running on modern .NET 6 Android.

Fixes #82193

(cherry picked from commit d8203e7)

* 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

(cherry picked from commit e486f38)

* Use 7.0 version of the ApiCompat suppressions

* Fix diff

---------

Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
@ghost ghost locked as resolved and limited conversation to collaborators Apr 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants