public static Task InitializeAsync(IContainer container, IBootstrapper bootstrapper) { if (container == null) { throw new ArgumentNullException("container"); } if (Container != null) { throw new InvalidOperationException( ExceptionMessages.ApplicationServiceLocator_TheContainerIsAlreadyInitialized); } Container = container; if (bootstrapper != null) { var task = container.InstallAsync(bootstrapper); return task.ContinueWith(t => { if (!IsInitializedSuccessfully) { throw new ContainerInitializationException(container); } }); } return Task.Factory.StartNew(() => { }); }