Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

"System.NullReferenceException" with GTK#

$
0
0

As a beginner, I wanted to make a simple game with Xamarin.Forms using GTK#. Unfortunately, when I started to use a Navigation Page, there is a line throwing a "System.NullReferenceException" error. When I debug the app with a real Android device it runs fine, so I guess the problem lies the GTK# part.

Here's the code for the GTK# part :

public static void Main (string[] args)
{
    Gtk.Application.Init();
    Forms.Init();

    var app = new App();
    var window = new FormsWindow();
    window.LoadApplication(app); //The line throwing the error
    window.SetApplicationTitle("OpenCountrySim");
    window.Show();

    Gtk.Application.Run();
}

And here's the app constructor :

public App()
{
    InitializeComponent();
    MainPage = new NavigationPage(new MainPage());
}

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>