Reputation: 85
Unhandled Exception: Firebase.Database.FirebaseException: Exception occured while processing the request. Url: https://mylimo-b2029.firebaseio.com/users/.json Request Data: Response: {"first_name":"dsadas"} occurred
Mainpage.xaml.cs
:
protected async override void OnAppearing()
{
base.OnAppearing();
var allUsers = await firebaseHelper.GetAllUsers();
lstPersons.ItemsSource = allUsers;
}
Firebasehelper.cs
:
public async Task<List<Users>> GetAllUsers()
{
return (await firebase
.Child("users")
.OnceAsync<Users>()).Select(item => new Users
{
//user_id = item.Object.user_id,
first_name = item.Object.first_name
}).ToList();
}
Upvotes: 5
Views: 3614
Reputation: 149
I had the same problem and decided to check if all properties are setting my local object. Just validating if the property is null, did not resolve.
Before:
var item = await firebase.Child("users").OnceAsync <Users> ());
Then:
using Newtonsoft.Json.Linq;
var item = await firebase.Child("users").OnceAsync <JObject> ());
The problem is in the deserialization. You can access the properties in the JObject with:
var itemProperty = item.Object.GetValue("<property_name>").
Upvotes: 6