I am getting the below error while looping through the contacts in Xamarin.Forms android project
"Expression of type 'System.Collections.Generic.IEnumerable1[Xamarin.Contacts.Contact]' cannot be used for return type 'System.Linq.IQueryable
1[Xamarin.Contacts.Contact]'"
Interestingly I found the same error in bugzilla, but no resolution is mentioned.
Could someone please help me in fixing the error
https://bugzilla.xamarin.com/show_bug.cgi?id=35244
Below is the method:
public async Task<IEnumerable<MobileUserContact>> All()
{
if (_contacts != null) return _contacts;
var contacts = new List<MobileUserContact>();
try
{
if (!await _book.RequestPermission())
{
Console.WriteLine("Permission denied");
return;
}
foreach (Contact contact in _book.OrderBy(c => c.LastName))
{
Console.WriteLine("{0} {1}", contact.FirstName, contact.LastName);
contacts.Add(new MobileUserContact(contact.FirstName, contact.LastName, ""));
}
return contacts;
}
catch (Exception ex)
{
throw;
}
}
it is using Xamarin.Mobile 0.7.1.0 version dll
I have enabled Read_Contacts permission