-1

i'm trying to retrieve data from a Table in Azure, using Cosmos Azure Table The tablemanager works fine as i also use it for retrive-operations. I read:

But i still dont understand how it happens. I set abreakpoint after the functions executes, so it does not stop in the method execution.... Is the Cosmos "ExecuteQuery" syntaks wrong? Or how can i solve this?

enter image description here

otk
  • 357
  • 5
  • 23

1 Answers1

1

Your variable results is a Task, and to get its contents, the thread for this task (which is not the current thread) must be able to run. The result of the task (it's IEnumerable<TableEntity>) cannot be retrieved without continuing the process. But you're on a breakpoint, so this is not possible.

You're doing nothing wrong. The debugger is just not able to get the value of that variable at this time. Continue execution or look at the result in the calling method.

PMF
  • 14,535
  • 3
  • 23
  • 49
  • Hi friend, doing that i find an error saying; System.InvalidCastException : Unable to cast object of type 'd__2`1[Microsoft.Azure.Cosmos.Table.TableEntity]' to type 'System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[Microsoft.Azure.Cosmos.Table.TableEntity]]'. I dont understand how to structure this to return the correct type. – otk Jan 12 '22 at 13:46
  • You probably need to `await` the task or access its `Result` property. Show the code that calls into this method. – PMF Jan 12 '22 at 14:40