private Type GetProviderDesignTimeServices(string provider, bool throwOnError) { Assembly providerAssembly; try { providerAssembly = _assemblyLoader.Load(provider); } catch (Exception ex) { if (!throwOnError) { return(null); } throw new OperationException(DesignCoreStrings.CannotFindRuntimeProviderAssembly(provider), ex); } var providerServicesAttribute = providerAssembly.GetCustomAttribute <DesignTimeProviderServicesAttribute>(); if (providerServicesAttribute == null) { if (!throwOnError) { return(null); } throw new InvalidOperationException( DesignCoreStrings.CannotFindDesignTimeProviderAssemblyAttribute( nameof(DesignTimeProviderServicesAttribute), provider)); } Assembly designTimeProviderAssembly; try { designTimeProviderAssembly = _assemblyLoader.Load(providerServicesAttribute.AssemblyName); } catch (Exception ex) when(ex is FileNotFoundException || ex is FileLoadException || ex is BadImageFormatException) { if (!throwOnError) { return(null); } throw new OperationException( DesignCoreStrings.CannotFindDesignTimeProviderAssembly(providerServicesAttribute.PackageName), ex); } return(designTimeProviderAssembly.GetType( providerServicesAttribute.TypeName, throwOnError: true, ignoreCase: false)); }