title: async Lazy<T> getting results right away
body: <p>I have the following:</p>
  
  <pre><code>public class User 
  {
          private readonly Lazy&lt;Task&lt;List&lt;ReminderDb&gt;&gt;&gt; _reminders;
  
          public SmsUserDb()
          {
              // Get _reminderReader from IoC
  
              _reminders = new Lazy&lt;Task&lt;List&lt;ReminderDb&gt;&gt;&gt;(async () =&gt; (List&lt;ReminderDb&gt;)await _reminderReader.Get(UserId));
          }
  
          public string UserId { get; set; }
          public Task&lt;List&lt;ReminderDb&gt;&gt; Reminders =&gt; _reminders.Value;
  }
  </code></pre>
  
  <p>When I instantiate an object Like so:</p>
  
  <pre><code>    var n = new SmsUserDb {UserId = "123456"};
      var rems = await n.Reminders;
  </code></pre>
  
  <p>This code works and I see that n.Reminders ="Waiting for activation" until I hit await n.Reminders line.</p>
  
  <p>However, when I query this User object from cache like so:</p>
  
  <pre><code>        var n1 = await _userReader.GetUserFromCache("+17084556675"); // return SmsUserDb
          var n2 = await n1.Reminders;
  </code></pre>
  
  <p>when it hits GetUserFromCache() it right away calls _reminderReader.Get(UserId) which calls cache again to get reminders. Then it simply times out. So Lazy doesn't work and most likely causes a deadlock.</p>
  
  <pre><code>public async Task&lt;SmsUserDb&gt; GetUserFromCache(string phoneNumber)
  {
      var hash = CachedObjectType.smsuser.ToString();
      var fieldKey = string.Format($"{CachedObjectType.smsuser.ToString()}:user-{phoneNumber}");
      var result = await _cacheUserService.GetHashedAsync(hash, fieldKey);
      return result;
  }
  
      private async Task&lt;List&lt;ReminderDb&gt;&gt; GetRemindersFromCache(string userId)
      {
          var hash = CachedObjectType.smsreminder.ToString();
          var fieldKey = string.Format($"{CachedObjectType.smsreminder.ToString()}:user-{userId}");
          var result = await _cacheService.GetHashedAsync(hash, fieldKey);
          return result ?? new List&lt;ReminderDb&gt;();
      }
  </code></pre>
  
  <p>What could be the problem?</p>