public override object CreateInstance(Type type, IEnumerable <KeyValuePair <string, object> > values, IServiceProvider serviceProvider, params Attribute[] attributes) { if (type == null) { throw new ArgumentNullException("type"); } object result = null; Type builderType = Adaptable.GetBuilderType(type); if (builderType == null) { return(Default.CreateInstance(type, values, serviceProvider, attributes)); } else { result = Default.CreateInstance(builderType, values, serviceProvider, attributes); MethodInfo mi; result = Adaptable.InvokeBuilder(result, out mi, serviceProvider); InitializeCoreHelper(result, mi.ReturnType, values, serviceProvider); } if (result == null) { throw RuntimeFailure.CannotActivateNoConstructorOrBuilder("type", type); } return(result); }