Skip to content

Issue with Winforms and MAUI.NET

Bartłomiej Buchała edited this page Feb 26, 2023 · 1 revision

There have been reports about using Jikan.Net with Winforms. For example, a code below should be executed during loading Form:

private void Form1_Load(object sender, EventArgs e)
{
    IJikan jikan = new Jikan();

    var animeTest = jikan.GetAnimeAsync(1).Result;

    this.label1.Text = animeTest.Title;
}

But for some reason, the IDE just hangs and no form is loaded... No error or warning either.

The catch is, Winforms is not so great with async methods, even when you use .Result to get data from Jikan.Net requests. The solution is to use async methods for Winforms events.

Changed code:

private async void Form1_Load(object sender, EventArgs e)
{
    IJikan jikan = new Jikan();

    var animeTest = await jikan.GetAnimeAsync(1);

    this.label1.Text = animeTest.Title;
}

Our label in form will now display "Cowboy Bebop" shortly after loading.

Very similar case has been reported for .NET MAUI platform

General information

Home Page

Getting started

Using own instance of Jikan

Migrating to version 2.0

Rate limiting

Winforms issue

Methods

Anime

Characters

Club

Manga

People

Rankings

Season

Search

Users

Other

Jikan Metadata

Class Schema

Main Classes

Secondary Classes

Search related classes

Enumerations Schema

Clone this wiki locally