Can't Use MGCB Editor on Linux

    Unhandled exception. System.TypeInitializationException: The type initializer for 'MonoGame.Tools.Pipeline.Global' threw an exception.
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.StackTrace, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'System.Diagnostics.StackTrace, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'


   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Eto.Drawing.Bitmap.FromResource(String resourceName, Assembly assembly)
   at MonoGame.Tools.Pipeline.Global..cctor()
   --- End of inner exception stack trace ---
   at MonoGame.Tools.Pipeline.Styles.<>c.<Load>b__9_0(ApplicationHandler h)
   at Eto.Style.<>c__DisplayClass13_0`1.<Add>b__0(THandler w)
   at Eto.DefaultStyleProvider.<>c__DisplayClass9_0`1.<Add>b__0(Object widget)
   at Eto.DefaultStyleProvider.ApplyStyles(Object widget, String style)
   at Eto.DefaultStyleProvider.Eto.IStyleProvider.ApplyStyle(Object widget, String style)
   at Eto.Widget.OnStyleChanged(EventArgs e)
   at Eto.Widget.set_Style(String value)
   at MonoGame.Tools.Pipeline.Program.CommandLineInterface.Run(InvocationContext context, String project)
   at MonoGame.Tools.Pipeline.Utilities.CommandLineParser.<>c__DisplayClass2_1.<.ctor>b__1()
   at MonoGame.Tools.Pipeline.Utilities.CommandLineParser.Invoke(String[] args)
   at MonoGame.Tools.Pipeline.Program.Main(String[] args)

I’m using Linux Mint 20.01 and VS Code. The editor doesn’t load when I right click on the Content.mgcb and choose the editor. This is the output when i call mgcb-editor from the terminal.

That looks like an old .NET Assembly, maybe you’re missing that version on your system?

I was googling “System.Runtime 4.1.2” but couldn’t find anything regarding my issue. I don’t know to retrieve that (or what exactly to retrieve in the first place).

This is what it looks like it’s trying to load:

I’m not familiar with the Linux development environment so I probably won’t be much help from here.

I reinstalled the OS and did everything mentioned on “Setting up MonoGame on Ubuntu 20.04” again. Then I installed .NET SDK 3.1 after the editor told me to and now it somehow works. That’s not a really effective solution but at least it works now.

Hi,

I had similar issues all the time. Since I discovered XNAssts all those kind of problems are gone.
Link: GitHub - rds1983/XNAssets: Alternative to MonoGame Content Pipeline that loads raw assets.

Regards
Andru

  1. Google Dotnet core
  2. Install the one for linux / BSD.
  3. Intall dotnet tools for monogame content pipeline:
    dotnet tool install --global dotnet-mgcb-editor
    mgcb-editor --register
  4. Since its registered, type in your console: mgcb-editor
  5. Done.

Since youre on linux, you will need to give it access to run but after than that, it should be fine.

1 Like