Back
Theme:

Xamarin using await .NET 4.8


I am using Xamarin C# .NET 4.8 version. When I was receiving much data from my API the app crash and close. The data is good and with small data works fine.

What I need to do to fix this?

Date: Thursday, January 19, 2023
1 answers | 215 view(s)
by Mauricio Junior

Answers

In my case, I changed the await command.

Sometimes I don't know but it's not working at all.

Doesn't work

await _client.GetAsync(uri);

Working fine

response = _client.GetAsync(uri).GetAwaiter().GetResult();

Check the code, I am using GetAwaiter( ) and GetResult ( ) at the end and it's working very very well. No more crash my app.

Thursday, January 19, 2023

Mauricio Junior


25