mxgmn / WaveFunctionCollapse

Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics
Other
23.05k stars 1.23k forks source link

Create runtimeconfig.template.json #77

Closed resinten closed 2 years ago

resinten commented 2 years ago

https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

On newer .NET releases, this no longer runs by default on non-Windows systems. Adding this config template allows System.Drawing.Common to be re-implemented in the build output so it can run on other platforms. Example stacktrace:

Unhandled exception. System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.
   at System.Drawing.LibraryResolver.EnsureRegistered()
   at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromFile(String filename, IntPtr& bitmap)
   at System.Drawing.Bitmap..ctor(String filename, Boolean useIcm)
   at System.Drawing.Bitmap..ctor(String filename)
mxgmn commented 2 years ago

I replaced System.Drawing with ImageSharp, should build now.

wilsonHodgson commented 1 year ago

When do you plan on publishing another release? this would be nice to have in the zip, and tar.gz of the source files, its a bit confusing downloading the latest release on linux or mac and having a breaking bug in it. Great work btw on this project, thank you for sharing it with us.

mxgmn commented 1 year ago

@wilsonHodgson Thanks! I added a comment to the release. I don't want to use ImageSharp in Windows releases because System.Drawing is noticeably faster.