title: Merge 2 Autofac containers into one
body: <p>is there a way i can merge 2 autoface container into 1?
  I mean that all registrations from both containers will be included in the new one
  Alternatively it could be upgrade one of them with the other</p>
  
  <p>For example:</p>
  
  <pre><code>public IContainer Merge(IContainer container1, IContainer container2)
  {
       return ???;
  }
  </code></pre>
  
  <p>I've tried iterating over "container.ComponentRegistry.Registrations" and by using containerBuilder registering components and upgrading the second container but for some reason there were some conflicts</p>
  
  <pre><code>    Autofac.Core.DependencyResolutionException : An exception was thrown while executing a resolve operation. See the InnerException for details. ---&gt; The provided instance has already been used in an activation request. Did you combine a provided instance with non-root/single-instance lifetime/sharing? (See inner exception for details.)
    ----&gt; System.InvalidOperationException : The provided instance has already been used in an activation request. Did you combine a provided instance with non-root/single-instance lifetime/sharing?
     at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
     at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
     at Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
     at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, ref Object instance)
     at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
     at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
     at Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters)
     at Autofac.ResolutionExtensions.Resolve(IComponentContext context)
     at Bootstrap.Bootstrapper.CreatePersistentTimerAsyncExecuter(IContainer container)
     at Bootstrap.Bootstrapper.Monitor(IContainer container)
     at Bootstrap.Bootstrapper.Boot(Assembly[] assemblies)
     at Soluto.Telemetry.Processing.Core.IntegrationTests.TelemetryProcessingBootstrapperTests.Boot_With2TelemetryHandlersInAssembly_ResolvesSubscriberWithItsHandlers() in TelemetryProcessingBootstrapperTests.cs: line 88
  --InvalidOperationException
     at Autofac.Core.Activators.ProvidedInstance.ProvidedInstanceActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
     at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
     at Autofac.Core.Resolving.InstanceLookup.&lt;Execute&gt;b__0()
     at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
     at Autofac.Core.Resolving.InstanceLookup.Execute()
     at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
     at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
     at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
  </code></pre>
  
  <p>Any Ideas ?</p>