Xamarin .NET strange timeout error after 10 rest calls

I encountered a strange behavior in the .Net SDK of your SDK (V6.0.1).
For describing this issue more detailed I have created two little demo apps, that nail down the issue.
First program is a .net console application, frequently asking a GET Rest and show that in the console what works brilliant.
Second program is a Xamarin.Forms iOS and Android app behaving really strange. The codebase is exactly the same than in the first program. The backend is behaving for the first 10 Rest-Calls as expected. But the next (11) call will run into following timeout error. I already did some more testing around, but it doesn’t matter which CRUD Operation you do, it’s always the 11th call that fails with the same error:

at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <079b3c6f37014c7f868f66c7f0ec79f9>:0
at System.Net.HttpWebRequest.EndGetRequestStream (System.IAsyncResult asyncResult) [0x00019] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:901
at Weborb.Client.HttpEngine.SetStreamDataCallback[T] (System.IAsyncResult asynchronousResult) [0x00020] in :0

You can simply reproduce this issue with creating a new Xamarin.forms solution from scratch, adding the latest Backendless .NET SDK to it and copy this code to the MainPage.cs
Simply add to the MainPage.xaml a button calling the Button_Clicked Event and hit this button more then 10 times.

public partial class MainPage : ContentPage
	{
		public static string APPLICATION_ID_DEV = "852EE6BB-B3FF-A610-FF25-F064DAE8E300";
		public static string APIKEY_DEV = "CED5DBDF-AD89-403A-B53D-8615C4273D7F";

		public MainPage()
		{
			InitializeComponent();

			Backendless.InitApp(APPLICATION_ID_DEV, APIKEY_DEV);
		}

		async void Button_Clicked(System.Object sender, System.EventArgs e)
		{
			await GetPeople();
		}

		int i = 1;
		async Task GetPeople()
		{
			try
			{
				var people = await BackendlessAPI.Backendless.Data.Of<Person>().FindAsync();
				string output = $"RestCall #{i++}\n";
				foreach (var person in people)
				{
					output += $"Name: {person.name}";
					Console.WriteLine(output);
				}
				OutputLabel.Text = output;
			}
			catch (Exception ex)
			{
				Debug.WriteLine($"Error {ex.Message}"); throw ex;
			}
		}
	}

	class Person
	{
		public string objectId { get; set; }
		public string name { get; set; }
	}

Hello @Janis.
Thanks for your report. I was able to reproduce the problem. We’ll look at this in more detail.

Regards, Nikita.

1 Like

@Janis, in a console application ( clean .NET Core), this issue is not reproducible, right?

that’s correct :+1:
For the console application I’ve used the JetBrains Rider 2020 as IDE.
Importing the SDK NuGet same than before with this code it’s running smooth.

using System;
using BackendlessAPI;

namespace TestApp
{
    class Program
    {
        static string APPLICATION_ID_DEV = "852EE6BB-B3FF-A610-FF25-F064DAE8E300";
        static string APIKEY_DEV = "CED5DBDF-AD89-403A-B53D-8615C4273D7F";

        static void Main(string[] args)
        {
            Backendless.InitApp(APPLICATION_ID_DEV, APIKEY_DEV);

            var i = 0;
            while (true)
            {
                Console.WriteLine(++i);
                new Program().GetPeople();

                var inp =Console.ReadLine();
                if (inp != String.Empty)
                    break;
            }
        }

        async void GetPeople()
        {
            var people = BackendlessAPI.Backendless.Data.Of<Person>().Find();
            foreach (var person in people)
            {
                Console.WriteLine($"Name: {person.name}");
            }
        }
    }

    class  Person
    {
        public string objectId { get; set; }
        public string name { get; set; }  
    }
}

@Janis, thanks for the additional information.
We will consider this problem in more detail.

1 Like

Any updates on this so far?

Hello, @Janis.
Sorry for the long wait. We are working on it.
Regards, Nikita

Hi, Is there any update to this, I have started building a Xamarin app and noticed the same issue - it all works ok but then you just get it timing out and no response back from the api

HI, @Janis, @Paul_Merricks.

Fix already done. It will be in the next release.

Regards, Viktor

1 Like

Excellent, I’ve switched to the rest api for now but will go back to this once its fixed. thanks

is there a planned release date?

Hi, @Janis

As the fix is already done we hope we can release it in a short time. Sorry, for the inconvenience.

Regards,
Marina

Hello @Janis, @Paul_Merricks2, @Paul_Merricks.

We are sorry for the long delay.
We have updated the Nugget package to version 6.2.0.

Regards, Nikita.

works thanks