Monogame: PlatformClear inconsistent accesability level

Created on 13 Feb 2020  路  5Comments  路  Source: MonoGame/MonoGame

GraphicsDevice.PlatformClear and GraphicsDevice.PlatformPresent are public when targeting OpenGL or Web but private when targeting DirectX. This can lead to errors when switching platforms or potentially cause a System.MethodAccessException when using assemblies built for a different platform.

What version of MonoGame does the bug occur on:

  • Develop

What operating system are you using:

  • Windows

What MonoGame platform are you using:

  • DesktopGL, WindowsDX
Good First Issue

Most helpful comment

Alright, I've got a free minute or two. May as well take a stab.

All 5 comments

Thanks for reporting this @bjornenalfa .... PlatformXXXX shouldn't be public at all on any platform. Those should all be internal/private APIs.

If someone gets a chance to fix this please submit a PR.

Alright, I've got a free minute or two. May as well take a stab.

The same fix is needed for GraphicsDevice.Web.cs

Additionally there's a public Mouse.PlatformSetCursor(...)
in Mouse.Default.cs and Mouse.Windows.cs

The web backend is just stubs, its not even getting compiled by the build bot, the real one lives in my fork.

@harry-cpp - Still the docs show any public APIs like that. So it would be good to fix it just to avoid it appearing in the docs.

Was this page helpful?
0 / 5 - 0 ratings