0

Async method (works fine in async code):

public async Task<ServiceResult<Config>> GetConfigAsync(string id)
        {
            var entity = await _entityRepo.FindAsync(t => t.Id == id);
            if (entity == null) throw new Exception($"entity Id {id} is invalid");
            var result = JsonConvert.DeserializeObject<Config>(entity.Config);
            return new ServiceResult<Config>(result);
        }

And I try to call it from sync code:

var configTask = _configurationService.GetConfigAsync(id);
var config = configTask.GetAwaiter().GetResult();

I can't see any issue, so it I just stuck.

What I do wrong?

Mediator
  • 14,951
  • 35
  • 113
  • 191

0 Answers0