title: Is ReuseScope.Request supported on .NET Core 3.1?
body: <p>We are getting an error on a ServiceStack application (v5.8 running in IIS) were it seems that requests are getting mixed up when executed concurrently.</p>
  <p>I've managed to reproduce fairly reliably with a simple console app that does this:</p>
  <pre><code>Parallel.ForEach(cfg.Emails, email =&gt;
  {
      var client = new JsonServiceClient(cfg.ApiBaseUrl);
      client.Timeout = TimeSpan.FromHours(1);
      AuthUser(client, email);
      GetUser(client, email);
  });
  </code></pre>
  <p><code>GetUser</code> returns the authenticated user and checks that it matches the email address it expects.  Firing 4 or 5 requests at a time causes at least one to fail every couple of runs.</p>
  <p>The current user is injected into the constructor of the service, using container configuration like:</p>
  <p><code>container.Register&lt;User&gt;(x =&gt; container.Resolve&lt;IDatabaseContext&gt;().GetUser()).ReusedWithin(ReuseScope.Request);</code></p>
  <p>IDatabaseContext is also configured to be re-used per-request:</p>
  <pre><code>container.Register&lt;IDatabaseContext&gt;(x =&gt; 
     new DbContext(container.TryResolve&lt;IRequest&gt;())).ReusedWithin(ReuseScope.Request);
  </code></pre>
  <p>It <em>appears</em> that trying to resolve IRequest from the container is unreliable.  I think this simple code inside a service method proves that:</p>
  <pre><code>var r = _container.Resolve&lt;IRequest&gt;();
  var cookie = Request.GetSessionId();
  var otherCookie = r.GetSessionId();
  if (cookie != otherCookie) throw new Exception(&quot;oh noes!&quot;);
  </code></pre>
  <p>The question is: is this supposed to be supported?  The docs here <a href="https://docs.servicestack.net/ioc" rel="nofollow noreferrer">https://docs.servicestack.net/ioc</a> suggest so (emphasis mine):</p>
  <blockquote>
  <p>ServiceStack uses a slightly modified version of Funq - which was adopted because of its excellent performance and memory characteristics. ServiceStack’s version of Funq has been enhanced with Expression-based Auto-wiring <strong>and lifetime Request Scope</strong>.</p>
  </blockquote>
  <p>However, searching around has lead to <a href="https://forums.servicestack.net/t/reusescope-request/6384" rel="nofollow noreferrer">https://forums.servicestack.net/t/reusescope-request/6384</a> which seems to be saying &quot;Don't use Request scope&quot;.</p>