mono / gtk-sharp

Gtk# is a Mono/.NET binding to the cross platform Gtk+ GUI toolkit and the foundation of most GUI apps built with Mono
http://www.mono-project.com/GtkSharp
Other
426 stars 141 forks source link

gtk init error mono #265

Open appletree111 opened 5 years ago

appletree111 commented 5 years ago

Steps to Reproduce

error: after invoke Gtk.Application.Init(),mono crash

my code:

public class Class1
    {
        public static void Main(string[] args)
        {
            try
            {
                Gtk.Application.Init(); 
            }
            catch (Exception ex)
            {
                System.IO.File.WriteAllText(@"C:\Users\wlq\Documents\error.txt", ex.Message + ex.StackTrace, Encoding.UTF8);
            }
            Forms.Init();

            var window = new FormsWindow(); 
            window.Show();

            Gtk.Application.Run(); 
       }

platforms : Windows 10

GTk Version: gtk-sharp-2.12.45

mono version: Mono JIT compiler version 5.16.0 (Visual Studio built mono)

## Stacktrace libglib-2.0-0.dll at (wrapper managed-to-native) GLib.Marshaller.g_utf16_to_utf8(char*,intptr,intptr,intptr,intptr&) at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00034] in :0 at GLib.Global.set_ProgramName (System.String value) [0x00001] in :0 at Gtk.Application.SetPrgname () [0x0000d] in <35293b6aa2744433b0e2f41f34e699d5>:0 at Gtk.Application.Init () [0x00001] in <35293b6aa2744433b0e2f41f34e699d5>:0 at MT.Class1.Main (System.String[] args) [0x00002] in <78ab4a6bdfde4a589bc664d09041cd02>:0