API request WaitingForActivation “Not yet computed” error

后端 未结 2 1400
终归单人心
终归单人心 2020-12-30 14:42

I\'m using the Poloniex C# API code from: https://github.com/Jojatekok/PoloniexApi.Net

On my console application the request to get balances is working, i make the A

2条回答
  •  悲哀的现实
    2020-12-30 15:26

    You cannot mix async and synchronous code like this. By calling .Wait, the UI thread is stuck waiting for the task to finish, but the task is essentially trying to "Invoke" on the UI thread, so it cannot finish. Result: deadlock.

    You can see more information about the basic problem here.

    One option, as a band-aid, is to use ConfigureAwait(false) on the await polo_client.Wallet.GetBalancesAsync() call; that will override the default behavior of trying to return to the UI thread. (Note that means you can't access the UI after the await, because it will be continuing on a different thread!)

    I have written a longer piece here about bringing async code into the core of a UI application.

提交回复
热议问题