Start a new topic

SyncAsync is ignoring query for iOS

Hi guys

I tried to use query parameter for dataStore.SyncAsync but it does not seem to work on Xamarin.

REST API URL does not show any query.

Is this a bug?


Not sure how this looks in Visual Studio, but in Xamarin Studio this looks like a mess...

Hello Slava,

After consulting with the libraries team, I am now able to answer your question.

The additional library dependencies that were added are a result of the PubNub library.  In order to support more versions of the .NET platform profiles, we upgraded the PubNub library version used.  The upgraded PubNub library has added additional dependencies, which is what you are seeing. They shouldn't pose a problem to your use of the SDK.

We hope that helps. Please let us know if you have further questions.


Billy Gee


Hello Slava,

I don't know but I will find out from Engineering and get back with you with an answer as soon as possible.


Billy Gee

Thanks Billy

I have updated to the latest version.

For some reason this adds dozens of additional libraries to my project (see below).

Why is this so?

 <package id="Microsoft.NETCore.Platforms" version="1.0.1" targetFramework="xamarinios10" />

  <package id="Microsoft.Win32.Primitives" version="4.0.1" targetFramework="xamarinios10" />

  <package id="NETStandard.Library" version="1.6.0" targetFramework="xamarinios10" />

  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="xamarinios10" />

  <package id="PubnubNetPlatform" version="" targetFramework="xamarinios10" />

 <package id="System.AppContext" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Collections" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Collections.Concurrent" version="4.0.12" targetFramework="xamarinios10" />

  <package id="System.Console" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Diagnostics.Tools" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Diagnostics.Tracing" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Globalization" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Globalization.Calendars" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.IO" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.IO.Compression" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.IO.Compression.ZipFile" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.IO.FileSystem" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Linq" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Linq.Expressions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Linq.Queryable" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Net.Http" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Net.Primitives" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Net.Requests" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Net.Sockets" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.ObjectModel" version="4.0.12" targetFramework="xamarinios10" />

  <package id="System.Reflection" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Reflection.Extensions" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Reflection.Primitives" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Reflection.TypeExtensions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Runtime" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.Extensions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.Handles" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.Numerics" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Text.Encoding" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Text.Encoding.Extensions" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Text.RegularExpressions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Threading" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Threading.Tasks" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Threading.ThreadPool" version="4.0.10" targetFramework="xamarinios10" />

  <package id="System.Threading.Timer" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Xml.XDocument" version="4.0.11" targetFramework="xamarinios10" />


Hello Slava,

A new version of the Xamarin SDK is available for download that should resolve this problem. It is Xamarin SDK v3.0,9. You can find it available at the following URL.

Please download and test it at your convenience.


Billy Gee

Hello Slava,

I just responded to your last inquiry in the Forum post that represents that problem, 

Please let us know if you have any questions.


Billy Gee

Thanks Billy

What about the other issue? 


Hello Slava,

I have an update for you. The fix for the original problem that you described in this post regarding SyncAsync ignoring query for iOS is being fixed and should be available in the next release which should be within the next two weeks, possibly sooner.

We will confirm when the release is available for download or if the target release changes.


Billy Gee

Hello Slava,

Please create a new post for this new problem so we can keep the original problem and engineering escalation separate from this new one. While you're doing that we will begin investigating this new problem.


Billy Gee

As it appears, the last issue is not related to SyncAsync (which explains why it was failing even with a preFetch hook).

It looks like if I supply my own _id, only basic Entity fields are populated.

Not sure if this is by design.


And another problem

If I use any query with PullAsync, even if I add it to a PreFetch hook,

when I create a new object I get all the collection fields empty except the default Entity fields.

All I do is this:

 await dataStore.SaveAsync(item);
 await dataStore.PushAsync();
 var query = from e in dataStore
 where e.creator_id == KinveyHelper.activeUser.Id
 select e;
 await dataStore.PullAsync(query);

If I remove query parameter all the fields are populated correctly

Thanks for a quick response.

Yes, the workaround helped to a point - I can see a query now.

More issues:

1. If I use a boolean in my query PullAsync does not work

This query

var query = from e in dataStore
 where e.creator_id == KinveyHelper.activeUser.Id || e.is_public
 select e;
does not emit a call at all - I see nothing in the log

This query

var query = from e in dataStore
 where e.creator_id == KinveyHelper.activeUser.Id || e.is_public == true
 select e;

 emits an incorrect URL, it should be "True" or true:

GET ->{"%24or":[{"creator_id":"5900a7f6c8ad28df6607df08"}%2C{"is_public":True}]}

2. If I use the below query the call is not emitted at all

var query = from e in dataStore
 where e.ACL.Creator == KinveyHelper.activeUser.Id
 select e;

I was also wondering if I could use FindWithMongoQueryAsync instead of PullAsync or had a PullAsync overload that takes MongoDB query string.

This would give me all the flexibility I need.



Hello Slava,

We have successfully reproduced this problem and we know what needs to be done to fix it. This should be fixed in the next release of our Xamarin SDK.

In the meantime, we believe that there is a workaround that might help you. I have already mentioned it in my last update as something to try.

Instead of calling `SyncAsync(query)`, try calling `PushAsync()`, followed by calling `PullAsync(query)`. This should be a reasonable workaround until this problem is fixed in the next version of the SDK.

Please let us know if you have any questions.


Billy Gee

Hello Slava,

We have two questions.

  1. Are you using `DataStoreType.SYNC` as a data store type?
  2. Please try a `FindAsync(query)` call on the same data store with the same query and let us know if it does or does not have the REST URL query in it?

The `SyncAsync` call is making a `PushAsync` call followed by a `PullAsync` call.  Perhaps there is an issue with the `PullAsync` portion. We are trying to reproduce the problem back here. We will update you as soon as we have something more to share. Until then, we look forward to hearing back from you with answers to the above questions.


Billy Gee

Login or Signup to post a comment