Hi everyone,
I have found this GUI library called myra. Sadly, I believe that it does not run on Linux (in general). I use Debian Buster. For programming I use Visual Studio (Community 2017, Version 15.9.21, NuGet Package Manager 4.6.0) and Windows 10.
According to the documentation I tried to create a simple project.
- Adding Reference to Myra · rds1983/Myra Wiki · GitHub
- Quick Start Tutorial · rds1983/Myra Wiki · GitHub
So I went to the Nuget Manager and installed this package.
After that I just inserted the source code of the “Quick Start Tutorial”. After compiling the “Debug Version” everything runs perfectly without any errors (Windows 10).
When I start now the same program (exe file) on Linux, an error appears. By the way, my other games, which do not use the library myra work perfectly on windows and Linux. Only when I use myra in my projects some errors show up.
The first error is about linq. I found a fix here c# - Issue with System.Xml.Linq on Mono - Stack Overflow. Basically, I just had to install some package with apt-get.
The second and final error I can not fix. Following error message from Debian (Buster):
server1@server:/media/server1/…/AnyCPU/Debug$ mono GUITestLinux.exe
Unhandled Exception:
System.TypeLoadException: Could not load type of field 'Cyotek.Drawing.BitmapFont.BitmapFont:k__BackingField' (22) due to: Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
at Myra.Assets.SpriteFontLoader.Load (XNAssets.AssetLoaderContext context, System.String assetName) [0x00020] in :0
at XNAssets.AssetManager.Load[T] (System.String assetName) [0x000d0] in :0
at XNAssets.AssetLoaderContext.Load[T] (System.String assetName) [0x00012] in :0
at Myra.Graphics2D.UI.Styles.StylesheetLoader.Load (XNAssets.AssetLoaderContext context, System.String assetName) [0x000b2] in :0
at XNAssets.AssetManager.Load[T] (System.String assetName) [0x000d0] in :0
at Myra.DefaultAssets.get_UIStylesheet () [0x0000d] in :0
at Myra.Graphics2D.UI.Styles.Stylesheet.get_Current () [0x00007] in :0
at Myra.Graphics2D.UI.Widget.SetStyle (System.String name) [0x00000] in :0
at Myra.Graphics2D.UI.Label…ctor (System.String styleName) [0x0002a] in :0
at GUITestLinux.Game1.LoadContent () [0x00077] in :0
at Microsoft.Xna.Framework.Game.Initialize () [0x00047] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at GUITestLinux.Game1.Initialize () [0x00001] in :0
at Microsoft.Xna.Framework.Game.DoInitialize () [0x0002c] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0002d] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at GUITestLinux.Program.Main () [0x00007] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field 'Cyotek.Drawing.BitmapFont.BitmapFont:k__BackingField' (22) due to: Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
at Myra.Assets.SpriteFontLoader.Load (XNAssets.AssetLoaderContext context, System.String assetName) [0x00020] in :0
at XNAssets.AssetManager.Load[T] (System.String assetName) [0x000d0] in :0
at XNAssets.AssetLoaderContext.Load[T] (System.String assetName) [0x00012] in :0
at Myra.Graphics2D.UI.Styles.StylesheetLoader.Load (XNAssets.AssetLoaderContext context, System.String assetName) [0x000b2] in :0
at XNAssets.AssetManager.Load[T] (System.String assetName) [0x000d0] in :0
at Myra.DefaultAssets.get_UIStylesheet () [0x0000d] in :0
at Myra.Graphics2D.UI.Styles.Stylesheet.get_Current () [0x00007] in :0
at Myra.Graphics2D.UI.Widget.SetStyle (System.String name) [0x00000] in :0
at Myra.Graphics2D.UI.Label…ctor (System.String styleName) [0x0002a] in :0
at GUITestLinux.Game1.LoadContent () [0x00077] in :0
at Microsoft.Xna.Framework.Game.Initialize () [0x00047] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at GUITestLinux.Game1.Initialize () [0x00001] in :0
at Microsoft.Xna.Framework.Game.DoInitialize () [0x0002c] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0002d] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at GUITestLinux.Program.Main () [0x00007] in :0
My question is: How can i fix this “error” so that my monogame projects run on windows and linux desktop PCs. By the way I really would love to use this library, it looks amazing to me. This author is a genious
Kind Regards
Andru