Skip to content

Troubleshooting and Common Problems

Curtis Wensley edited this page Mar 6, 2019 · 9 revisions

When troubleshooting errors in Eto.Forms, be sure to check the inner exception(s). You can do this by adding $exception.GetBaseException() to the watch window after an exception is thrown.

Problem: WPF platform does not run, but other platforms do

Exception thrown: Eto.HandlerInvalidException: Could not create instance of type Eto.Forms.IForm
Base exception: InvalidOperationException: The calling thread must be STA, because many UI components require this.
Solution: Add [STAThread] to your Main() method

Problem: Newtonsoft.Json is clearly available, Eto.Json refuses to load it.

Exception thrown: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. Solution: Use the following runtime redirect in your app.config file:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Problem: My MonoMac/Xamarin.Mac project compiles, but quits immediately

This is usually caused when you have something set for the NSMainNibFile setting in your Info.plist file. It is by default set to MainMenu. To fix this, set it to blank. In Xamarin Studio:

  1. Double click on the Info.plist file
  2. Set the Main Interface box to blank
  3. Save and run your application again.

You can also follow these directions to create a new MonoMac/Xamarin.Mac project.

Problem: When distributing an OS X app to users, the application quits with the message "The operation couldn’t be completed. (OSStatus error -67062.)"

This is caused because you are archiving the .app bundle on your Mac, which will include the __MACOS folder in the archive to set file permissions, etc. You must create a .zip archive without the __MACOS folder by zipping on Windows, or following these instructions on OS X.

Problem: GTK# v2 app is not running on windows.

This can happen sometimes when the paths aren't set up correctly by the GTK#2 installer, and is not a problem with Eto.Forms. Uninstalling then re-installing GTK# v2 (from here) and rebooting your machine usually works. See here for details if you want to get around this issue.

Problem: I'd like to run Gtk on Windows or Mac.

See [this wiki page](How to run Gtk platform on Windows, Linux, and Mac.)

Clone this wiki locally