title: CosmosDb c# SDK is not working on contrary to the Rest Api
body: <p>I am using CosmosDb Sdk with nuget <code>Microsoft.Azure.DocumentDB.Core 2.1.0</code> with <code>.NetStandard 2.0</code>.</p>
  
  <p>I am using this query to fetch documents</p>
  
  <pre><code>var client client = new DocumentClient(new Uri(config.CosmosDbEndPointUrl), config.CosmosDbPrimaryKey);
  var partitionKey = "siteId"; // the partition key is defined as /siteId, I tried both, still not working
  var queryOptions = new FeedOptions
  {
    MaxItemCount = 500,
    EnableCrossPartitionQuery = true,
    PartitionKey = new PartitionKey(partitionKey)
  };
  
  var auditQuery = client
      .CreateDocumentQuery&lt;AuditDTO&gt;(
       UriFactory.CreateDocumentCollectionUri(_databaseName, _collectionName), queryOptions)
          .Where(f =&gt; f.Status == AuditStatus.Pending)
          .AsDocumentQuery();
  
  var results = new List&lt;AuditDTO&gt;();
  while (auditQuery.HasMoreResults)
  {
    var audits = await auditQuery.ExecuteNextAsync&lt;AuditDTO&gt;();
    results.AddRange(audits);
  }
  </code></pre>
  
  <p>This query returns 0 document.</p>
  
  <p>I based my query on <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started#Query" rel="nofollow noreferrer">this tutorial</a></p>
  
  <p>I thought some parameters were incorrect so, I tried to use the Rest Api, code based on <a href="https://github.com/Azure/azure-cosmosdb-dotnet/blob/master/samples/rest-from-.net/Program.cs" rel="nofollow noreferrer">this example</a> (see comment <code>EXECUTE a query</code>)</p>
  
  <pre><code>var client = new System.Net.Http.HttpClient();
  string response = string.Empty;
  string authHeader = string.Empty;
  string verb = string.Empty;
  string resourceType = string.Empty;
  string resourceId = string.Empty;
  string resourceLink = string.Empty;
  client.DefaultRequestHeaders.Add("x-ms-date", utc_date);
  client.DefaultRequestHeaders.Add("x-ms-version", "2017-02-22");
  
  verb = "POST";
  resourceType = "docs";
  resourceLink = $"dbs/{databaseId}/colls/{collectionId}/docs";
  resourceId = (idBased) ? $"dbs/{databaseId}/colls/{collectionId}" : collectionId.ToLowerInvariant();
  
  authHeader = GenerateMasterKeyAuthorizationSignature(verb, resourceId, resourceType, masterKey, "master", "1.0");
  
  client.DefaultRequestHeaders.Remove("authorization");
  client.DefaultRequestHeaders.Add("authorization", authHeader);
  client.DefaultRequestHeaders.Add("x-ms-documentdb-isquery", "True");
  client.DefaultRequestHeaders.Add("x-ms-documentdb-query-enablecrosspartition", "true");
  client.DefaultRequestHeaders.Add("x-ms-partition-key", "[\"siteId\"]");
  
  var qry = new SqlQuerySpec { query = "SELECT * FROM root WHERE (root[\"status\"] = 0)" };
  var r = await client.PostWithNoCharSetAsync(new Uri(baseUri, resourceLink), qry);
  var s = await r.Content.ReadAsStringAsync();
  </code></pre>
  
  <p>Using the Rest Api returns 1 document as I am expecting. </p>
  
  <p>I tried to deserialize the response to the class AuditDTO, it works, so, no problem with my model.</p>
  
  <p>I don't understand why the Rest Api is working and not the .Net Sdk.</p>
  
  <p>There is no authorization exception, no error message. I just get 0 document.</p>
  
  <p>I am missing something?</p>