title: Unity MVC GetService In Background Thread throws NullReferenceException
body: <p>As far as I know the DependencyResolver is Thread-Safe, however, running the following code throws a null reference exception in a background thread.</p>
  
  <pre><code>public interface ITest {
  
  }
  public class Test : ITest {
  
  }
  
  //this works fine
  var service = DependencyResolver.Current.GetService&lt;ITest&gt;();
  
  var t1 = Task.Run(() =&gt; {
     //This throws a Null Reference exception.
     // note that DependencyResolver.Current is NOT null.  
     // The exception occurs in GetService
     var s1 = DependencyResolver.Current.GetService&lt;ITest&gt;();
  });
  Task.WaitAll(t1);
  </code></pre>
  
  <p>Here's the stack trace:</p>
  
  <pre><code>at Unity.Mvc4.UnityDependencyResolver.get_ChildContainer()
  at Unity.Mvc4.UnityDependencyResolver.IsRegistered(Type typeToCheck)
  at Unity.Mvc4.UnityDependencyResolver.GetService(Type serviceType)
  at System.Web.Mvc.DependencyResolverExtensions.GetService[TService](IDependencyResolver resolver)
  at System.Threading.Tasks.Task.InnerInvoke()
  at System.Threading.Tasks.Task.Execute()
  </code></pre>
  
  <p>I'm aware that the "Service Locator" pattern is an anti-pattern.  At this point I'm just trying to understand why this doesn't work.  </p>
  
  <p>Any insights would be appreciated.</p>
  
  <p>Thanks!</p>