Out parameters in Async methods.

A little while ago, I wanted to have an asynchronous method that returned a string but also populated an integer “out” parameter. So I started writing the method as below // Note: This will give compiler error. private async Task<string> GetUserDetails(out int userRegionCode) {     userRegionCode=105;     return “samplestring”; } However, the compiler showed an […]

Cannot access a disposed object. ‘System.Net.Http.StringContent’ While having retry logic.

Hi, I faced this scenario today when I was trying to make an HttpPost call using a retry logic wherein I was getting an ObjectDisposedException while trying to retry for the first time. Exception Message: Cannot access a disposed object. Object name: ‘System.Net.Http.StringContent’ My calling code was something like this. var httpContent = GetHttpContent(); retryPolicy.ExecuteWithRetry(async […]