/// <summary> /// Creates a new instance of a component using the provided factory. /// </summary> /// <param name="factory"></param> /// <param name="unresolvedDependencies"></param> /// <param name="providedParameters"></param> /// <returns></returns> /// <exception cref="ComponentCreationException"></exception> private object CreateInstance(IComponentFactory factory, ISet <Type> unresolvedDependencies, object[] providedParameters = null) { try { var instance = factory.CreateInstance(this, unresolvedDependencies, providedParameters); return(OnPostConstruct(instance, "")); // TODO Component name } catch (Exception e) { if (e is CircularDependencyException) { throw; } throw new ComponentCreationException(string.Format("Failed to create instance using component builder '{0}'", factory), e); } }