animekun
animekun

Reputation: 1869

Xamarin Forms on iOS, while debugging elements turns to null

I have a Xamarin Forms App, it works fine, but on click events it doesn't work, I tried to debug and noticed that my gui objects are all turned to null, I don't even know why, I tried to compare it with null and re-initialize then, but this if-statement just was ignored by mono! What the heck?

here is my class: http://pastebin.com/jDufJ9sb

ActivityIndicator turn to null I don't know when, but when I check it on 224 line, and Debugger shows that it is null, but if-statement doesn't run properly

Upvotes: 0

Views: 69

Answers (1)

Daniel Luberda
Daniel Luberda

Reputation: 7454

You're using async method for views initialization:

private async Task Load(Profile profile)

There're places where you call that function (eg. line 70):

  • without await (so fire and forget)
  • without using Device.BeginInvokeOnMainThread. Remember: All operations on UI must be done from UI thread.

Upvotes: 1

Related Questions