title: ServiceStack: container.AutoWire(this) gives a NullReferenceException
body: <p>If I in my AppHostBase descendant (web api project ) use <code>container.AutoWire(this)</code>, it will result in a <code>NullReferenceException</code> in the ServiceStack code, if I am using a web project, thus starting it with the <code>CreateHostBuilder(args).Build().Run();</code> in the main method.</p>
  <p>The error is reproduced in this Github project: <a href="https://github.com/tedekeroth/ServiceStackAutoWireTest" rel="nofollow noreferrer">https://github.com/tedekeroth/ServiceStackAutoWireTest</a></p>
  <p>The error occurs in AppHostBase.Netcore.Cs, line 158:</p>
  <p><a href="https://i.stack.imgur.com/6hJe0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6hJe0.png" alt="enter image description here" /></a></p>
  <p>If I remove the <code>container.AutoWire(this);</code> in TestAppHost.cs, the error goes away, but then the dependency injection does not work, meaning the <code>Logger</code> in <code>TestAppHost</code>property is not assigned:</p>
  <p><a href="https://i.stack.imgur.com/UbJZ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UbJZ3.png" alt="enter image description here" /></a></p>
  <p>I am not sure why this happens or what I can do about it. I'd appreciate some input, thanks.</p>
  <p><strong>Setup</strong><br>
  Visual Studio 2019<br>
  Target framework: .NET 5.0 (Console Application)<br>
  Project SDK: Microsoft.NET.Sdk.Web<br>
  ServiceStack 5.11.0</p>