How would I run an async Task method synchronously?

Here’s a workaround I found that works for all cases (including suspended dispatchers). It’s not my code and I’m still working to fully understand it, but it does work. It can be called using: customerList = AsyncHelpers.RunSync<List<Customer>>(() => GetCustomers()); Code is from here public static class AsyncHelpers { /// <summary> /// Execute’s an async Task<T> … Read more

How and when to use ‘async’ and ‘await’

When using async and await the compiler generates a state machine in the background. Here’s an example on which I hope I can explain some of the high-level details that are going on: public async Task MyMethodAsync() { Task<int> longRunningTask = LongRunningOperationAsync(); // independent work which doesn’t need the result of LongRunningOperationAsync can be done … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)