Closed tyrone0501 closed 9 months ago
Reviewing issue
Problem seems to be related specifically to the Azure.Cosmos package and the CosmosClient. The Microsoft.Azure.Cosmos CosmosClient works without any issues, but lacks the ability to work with Asynchronous streams.
It's probably best to update the used package to Microsoft.Azure.Cosmos and adapt the new pattern to iterate.
Replace:
await foreach (Product product in container.GetItemQueryIterator<Product>(query)) { Console.WriteLine($"[{product.id}]\t{product.name,35}\t{product.price,15:C}"); }
With:
`using FeedIterator
while (feed.HasMoreResults)
{
FeedResponse
I'd contribute myself but sadly i'm not a MCT :(
When you first open script.cs in Lab 09, you need to run the following terminal commands to make sure the code compiles correctly with the newer version of the framework.
You can then proceed as directed.
issue has been fixed
Module: 05
Lab/Demo: 09
Task: 04
Step: 14
Description of issue Every time I try to run the query the following error appears:
handled exception. System.MissingMethodException: Method not found: 'System.String Microsoft.Azure.Documents.IAuthorizationTokenProvider.GetUserAuthorizationToken(System.String, System.String, System.String, Microsoft.Azure.Documents.Collections.INameValueCollection, Microsoft.Azure.Documents.AuthorizationTokenType, System.String ByRef)'.
Repro steps:
Included the following code with the correct endpoints and keys:
using System; using Azure.Cosmos;
string endpoint = "";
string key = "";
CosmosClient client = new CosmosClient(endpoint, key);
CosmosDatabase database = await client.CreateDatabaseIfNotExistsAsync("cosmicworks");
CosmosContainer container = await database.CreateContainerIfNotExistsAsync("products", "/categoryId");
string sql = "SELECT * FROM products p"; QueryDefinition query = new (sql);
await foreach (Product product in container.GetItemQueryIterator(query))
{
Console.WriteLine($"[{product.id}]\t{product.name,35}\t{product.price,15:C}");
}
and received an error when I tried to run the application with donet run