async await in image loading

Your problem here extends from the definition for await… The await operator is used to wait for a Promise The Image.prototype.onload property is not a promise, nor are you assigning it one. If you’re wanting to return the height property after loading, I would instead create a Promise… addImageProcess(src){ return new Promise((resolve, reject) => { … Read more

Cannot implicitly convert type from Task

The main issue with your example that you can’t implicitly convert Task<T> return types to the base T type. You need to use the Task.Result property. Note that Task.Result will block async code, and should be used carefully. Try this instead: public List<int> TestGetMethod() { return GetIdList().Result; }

Horrible performance using SqlCommand Async methods with large data

On a system without significant load, an async call has a slightly bigger overhead. While the I/O operation itself is asynchronous regardless, blocking can be faster than thread-pool task switching. How much overhead? Let’s look at your timing numbers. 30ms for a blocking call, 450ms for an asynchronous call. 32 kiB packet size means you … Read more