Microsoft Graph Get All Users Exception Unsupported Query

I can submit this query to Microsoft Graph Explorer but in C# I get the an error message: "Microsoft.Graph.ServiceException: "Code: Request_UnsupportedQuery Message: Unsupported Query."

var users = await graphClient.Users
    .Request()
    .Filter("endswith(mail,'@mydomain.com')")
    .OrderBy("userPrincipalName")
    .GetAsync();

You should send a header ConsistencyLevel=eventual and also $count query parameter to make it work.

To add $count query parameter you can use queryOptions.

List<QueryOption> queryOptions = new List<QueryOption>
{                                                  
    new QueryOption("$count", true) 
}; 

var users = await graphClient.Users
    .Request(queryOptions)
    .Filter("endswith(mail,'@mydomain.com')")
    .OrderBy("userPrincipalName")
    .GetAsync();

The API call what look something like this

https://graph.microsoft.com/v1.0/users?$count=true&$filter=endswith(mail, '@domain.live')&$orderBy=userPrincipalName

You can always test these calls in Graph Explorer.