public bool Error(string id, string category, string targetObjectValue, string messageText) { if (CanCallHost) { return(_hostApi.Error(id, category, targetObjectValue, GetMessageString(messageText, null) ?? messageText)); } return(true); }
public bool Error(string id, string category, string targetObjectValue, string messageText) { return(_hostApi.Error(id, category, targetObjectValue, messageText)); }
private PackageProvider ImportProvider(IHostApi request, string providerName, IMetaProvider powerShellMetaProvider) { //foreach (var providerName in providers) { //var matchedProviderName = provider.As<DefaultPackageProvider>().GetPackageProviderName(); //TODO pass in Maxi, mini, and requiredVersion to LoadAvailableProvider var instance = powerShellMetaProvider.LoadAvailableProvider(request.As<IRequest>(), providerName); if (instance == null) { return null; } //Register newly created provider if (typeof(IPackageProvider).CanDynamicCastFrom(instance)) { var packageProvider = RegisterPackageProvider(instance.As<IPackageProvider>(), providerName, String.Empty, request); if (packageProvider != null) { packageProvider.ProviderPath = powerShellMetaProvider.GetProviderPath(providerName); return packageProvider; } } else { //A provider is not found request.Error(Constants.Messages.UnknownProvider, ErrorCategory.InvalidOperation.ToString(), providerName, request.FormatMessageString(Constants.Messages.UnknownProvider, providerName)); } } }
private IMetaProvider GetMetaProviderObject(IHostApi requestObject) { if (_metaProviders.ContainsKey("powershell")) { var powerShellMetaProvider = _metaProviders["powershell"]; if (powerShellMetaProvider != null) { return powerShellMetaProvider; } } requestObject.Error(Constants.Messages.FailedPowerShellMetaProvider, ErrorCategory.InvalidOperation.ToString(), "LoadProvider", requestObject.FormatMessageString(Constants.Messages.FailedPowerShellMetaProvider)); return null; }
/// <summary> /// Get available provider if -ListAvailable present;load a provider specified in providerName. /// </summary> /// <param name="request"></param> /// <param name="providerName">provider to be loaded.</param> /// <param name="powerShellMetaProvider"></param> private IEnumerable<PackageProvider> GetAvailableProvider(IHostApi request, string providerName, IMetaProvider powerShellMetaProvider) { var results = _packageProviders.Values.Where(each => each.ProviderName.IsWildcardMatch(providerName)).ReEnumerable(); if (results.Any()) { //the provider is already loaded and tracked in the loaded master list: _packageProviders yield break; } //Get available powershell providers var availableProviders = powerShellMetaProvider.GetAvailableLocallyProviders(request.As<IRequest>()).ReEnumerable(); if (!availableProviders.Any()) { //No available providers. if (!String.IsNullOrWhiteSpace(providerName)) { //Error out if a user specific -Name request.Error(Constants.Messages.UnknownProvider, ErrorCategory.InvalidOperation.ToString(), providerName, request.FormatMessageString(Constants.Messages.UnknownProvider, providerName)); } yield break; } if (String.IsNullOrWhiteSpace(providerName)) { // "-Name" does not exist, we return all we can find foreach (var module in availableProviders) { yield return new PackageProvider(module.As<DefaultPackageProvider>()); } } else { //A user inputs both -Name and -ListAvailable var matches = powerShellMetaProvider.GetProviderNames().Where(each => each.IsWildcardMatch(providerName)).ReEnumerable(); if (!matches.Any()) { request.Error(Constants.Messages.UnknownProvider, ErrorCategory.InvalidOperation.ToString(), providerName, request.FormatMessageString(Constants.Messages.UnknownProvider, providerName)); } foreach (var match in matches) { yield return new PackageProvider(powerShellMetaProvider.GetAvailableLocallyProvider(match).As<DefaultPackageProvider>()); //yield return new PackageProvider(availableProviders[match].As<DefaultPackageProvider>()); } } }
private IEnumerable<PackageProvider> ImportPackageProviderViaName(IHostApi request, string providerName) { var powerShellMetaProvider = GetMetaProviderObject(request); if (powerShellMetaProvider == null) { yield break; } //var availableProvider = powerShellMetaProvider.GetAvailableLocallyProviders(request.As<IRequest>()).ReEnumerable(); var availableProviderNames = powerShellMetaProvider.GetProviderNames(); //.ReEnumerable(); if (!availableProviderNames.Any()) { //No available providers. if (!String.IsNullOrWhiteSpace(providerName)) { //Error out if a user specific -Name request.Error(Constants.Messages.UnknownProvider, ErrorCategory.InvalidOperation.ToString(), providerName, request.FormatMessageString(Constants.Messages.UnknownProvider, providerName)); } yield break; } // a user inputs "-Name" property, we load the specific provider //Find if it exists in the available list var matches = availableProviderNames.Where(each => each.IsWildcardMatch(providerName)).ReEnumerable(); if (!matches.Any()) { request.Error(Constants.Messages.UnknownProvider, ErrorCategory.InvalidOperation.ToString(), providerName, request.FormatMessageString(Constants.Messages.UnknownProvider, providerName)); } foreach (var match in matches) { //var matchedProviderName = match.As<DefaultPackageProvider>().GetPackageProviderName(); yield return ImportProvider(request, match, powerShellMetaProvider); //var instance = powerShellMetaProvider.LoadAvailableProvider(request.As<IRequest>(), matchedProviderName); //if (instance == null) { // yield break; //} ////Register newly created provider //if (typeof (IPackageProvider).CanDynamicCastFrom(instance)) { // var packageProvider = RegisterPackageProvider(instance.As<IPackageProvider>(), String.Empty, request); // if (packageProvider != null) { // packageProvider.ProviderPath = powerShellMetaProvider.GetProviderPath(matchedProviderName); // yield return packageProvider; // } //} else { // //A provider is not found // request.Error(Constants.Messages.UnknownProvider, ErrorCategory.InvalidOperation.ToString(), // providerName, request.FormatMessageString(Constants.Messages.UnknownProvider, providerName)); //} } }
private IEnumerable<PackageProvider> ImportPowerShellProvider(IHostApi request, string modulePath, Version requiredVersion, bool shouldRefreshCache) { request.Debug(string.Format(CultureInfo.CurrentCulture, "Calling ImportPowerShellProvider. providerName = '{0}', requiredVersion='{1}'", modulePath, requiredVersion)); var powerShellMetaProvider = GetMetaProviderObject(request); if (powerShellMetaProvider == null) { yield break; } //providerName can be a file path or name. var instances = powerShellMetaProvider.LoadAvailableProvider(request.As<IRequest>(), modulePath, requiredVersion, shouldRefreshCache).ReEnumerable(); if (!instances.Any()) { //A provider is not found request.Error(Constants.Messages.UnknownProvider, ErrorCategory.InvalidOperation.ToString(), modulePath, string.Format(Resources.Messages.UnknownProvider, modulePath)); yield break; } foreach (var instance in instances) { //Register the provider var provider = instance.As<PackageProvider>(); if (provider != null) { //initialize the actual powershell package provider if (provider.Provider == null) { continue; } provider.Provider.InitializeProvider(request.As<IRequest>()); AddToProviderCacheTable(provider.ProviderName, provider); //initialize the warpper package provider provider.Initialize(request); // addOrSet locks the collection anyway. _packageProviders.AddOrSet(provider.ProviderName, provider); yield return provider; } } }
public bool RequirePackageProvider(string requestor, string packageProviderName, string minimumVersion, IHostApi hostApi) { // check if the package provider is already installed if (_packageProviders.ContainsKey(packageProviderName)) { var current = _packageProviders[packageProviderName].Version; if (current >= minimumVersion) { return true; } } var currentCallCount = hostApi.CallCount; if (_lastCallCount >= currentCallCount) { // we've already been here this call. // are they asking for the same provider again? if (_providersTriedThisCall.Contains(packageProviderName)) { hostApi.Debug("Skipping RequirePackageProvider -- tried once this call previously."); return false; } // remember this in case we come back again. _providersTriedThisCall.Add(packageProviderName); } else { _lastCallCount = currentCallCount; _providersTriedThisCall = new HashSet<string> { packageProviderName }; } if (!hostApi.IsInteractive) { hostApi.Debug("Skipping RequirePackageProvider due to not interactive"); // interactive indicates that the host can respond to queries -- this doesn't happen // in powershell during tab-completion. return false; } // no? // ask the bootstrap provider if there is a package provider with that name available. if (!_packageProviders.ContainsKey(packageProviderName)){ return false; } var bootstrap = _packageProviders["Bootstrap"]; if (bootstrap == null) { hostApi.Debug("Skipping RequirePackageProvider due to missing bootstrap provider"); return false; } var pkg = bootstrap.FindPackage(packageProviderName, null, minimumVersion, null, hostApi).OrderByDescending(p => p, SoftwareIdentityVersionComparer.Instance).GroupBy(package => package.Name).ToArray(); if (pkg.Length == 1) { // Yeah? Install it. var package = pkg[0].FirstOrDefault(); var metaWithProviderType = package.Meta.FirstOrDefault(each => each.ContainsKey("providerType")); var providerType = metaWithProviderType == null ? "unknown" : metaWithProviderType.GetAttribute("providerType"); var destination = providerType == "assembly" ? (AdminPrivilege.IsElevated ? SystemAssemblyLocation : UserAssemblyLocation) : String.Empty; var link = package.Links.FirstOrDefault(each => each.Relationship == "installationmedia"); var location = String.Empty; if (link != null) { location = link.HRef.ToString(); } // what can't find an installationmedia link? // todo: what should we say here? if (hostApi.ShouldBootstrapProvider(requestor, package.Name, package.Version, providerType, location, destination)) { var newRequest = hostApi.Extend<IHostApi>(new { GetOptionValues = new Func<string, IEnumerable<string>>(key => { if (key == "DestinationPath") { return new[] { destination }; } return new string[0]; }) }); var packagesInstalled = bootstrap.InstallPackage(package, newRequest).LastOrDefault(); if (packagesInstalled == null) { // that's sad. hostApi.Error(Constants.Messages.FailedProviderBootstrap, ErrorCategory.InvalidOperation.ToString(), package.Name, hostApi.FormatMessageString(Constants.Messages.FailedProviderBootstrap, package.Name)); return false; } // so it installed something // we must tell the plugin loader to reload the plugins again. LoadProviders(hostApi); return true; } } return false; }
private IEnumerable<PackageProvider> ImportPackageProviderViaName(IHostApi request, string providerName, Version requiredVersion, Version minimumVersion, Version maximumVersion, bool force) { request.Debug(string.Format(CultureInfo.CurrentCulture, "Calling ImportPackageProviderViaName. providerName = '{0}', requiredVersion='{1}', minimumVersion = '{2}', maximumVersion='{3}'", providerName, requiredVersion, minimumVersion, maximumVersion)); //Check if the module or assembly is already loaded //key = path, value = version HashSet<KeyValuePair<string, string>> refreshingProvidersPaths = new HashSet<KeyValuePair<string, string>>(); foreach (var provider in _packageProviders) { if (provider.Key.IsWildcardMatch(providerName)) { //found the provider with the same name is already loaded if (force) { if (IsVersionMatch(provider.Value, requiredVersion, minimumVersion, maximumVersion)) { //if -force is specified and the version is the same, we will re-import directly from the path refreshingProvidersPaths.Add(new KeyValuePair<string, string>(_packageProviders[provider.Key].ProviderPath, _packageProviders[provider.Key].Version)); } request.Verbose(string.Format(CultureInfo.CurrentCulture, Resources.Messages.ReImportProvider, provider.Key)); } else { request.Verbose(string.Format(CultureInfo.CurrentCulture, Resources.Messages.ProviderImportedAlready, provider.Key)); return Enumerable.Empty<PackageProvider>(); } } } //reload the assembly foreach (var providerPath in refreshingProvidersPaths) { var providers = ImportPackageProviderViaPath(request, providerPath.Key, requiredVersion, minimumVersion, maximumVersion, force); return providers; } //check if the provider is in the cache table var results = FindMatchedProvidersFromInternalCacheTable(request, providerName, requiredVersion, minimumVersion, maximumVersion, force).ToArray(); if (results.Any()) { return results; } //If the provider is not in the cache list, rescan for providers ScanForAvailableProviders(request, providerName, requiredVersion, minimumVersion, maximumVersion, true); results = FindMatchedProvidersFromInternalCacheTable(request, providerName, requiredVersion, minimumVersion, maximumVersion, force).ToArray(); if (!results.Any()) { request.Error(Constants.Messages.NoMatchFoundForCriteria, ErrorCategory.InvalidData.ToString(), providerName, string.Format(CultureInfo.CurrentCulture, Resources.Messages.NoMatchFoundForCriteria, providerName)); } else { return results; } return Enumerable.Empty<PackageProvider>(); }
/// <summary> /// Import a package provider. /// </summary> /// <param name="request"></param> /// <param name="providerName">Provider name or file path</param> /// <param name="requiredVersion">The provider version to be loaded</param> /// <param name="minimumVersion">The minimum version of the provider to be loaded</param> /// <param name="maximumVersion">The maximum version of the provider to be loaded</param> /// <param name="isPathRooted">Whether the 'providerName' is path or name</param> /// <param name="force">Whether -force is specified</param> /// <returns></returns> public IEnumerable<PackageProvider> ImportPackageProvider(IHostApi request, string providerName, Version requiredVersion, Version minimumVersion, Version maximumVersion, bool isPathRooted, bool force) { request.Debug(string.Format(CultureInfo.CurrentCulture, "Calling ImportPackageProvider. providerName = '{0}', requiredVersion='{1}', minimumVersion = '{2}', maximumVersion='{3}'", providerName, requiredVersion, minimumVersion, maximumVersion)); if (string.IsNullOrWhiteSpace(providerName)) { return Enumerable.Empty<PackageProvider>(); } if (providerName.ContainsWildcards()) { request.Error(Constants.Messages.InvalidParameter, ErrorCategory.InvalidData.ToString(), providerName, string.Format(CultureInfo.CurrentCulture, Resources.Messages.InvalidParameter, "Import-PackageProvider")); return Enumerable.Empty<PackageProvider>(); } if (isPathRooted) { if (!File.Exists(providerName)) { request.Error(Constants.Messages.InvalidFilename, ErrorCategory.InvalidData.ToString(), providerName, string.Format(CultureInfo.CurrentCulture, Resources.Messages.FileNotFound, providerName)); return Enumerable.Empty<PackageProvider>(); } //Check if the file type is supported: .dll, .exe, or .psm1 if (!Constants.SupportedAssemblyTypes.Any(each => each.EqualsIgnoreCase(Path.GetExtension(providerName)))) { var fileTypes = Constants.SupportedAssemblyTypes.Aggregate(string.Empty, (current, each) => current + " " + each); request.Error(Constants.Messages.InvalidFilename, ErrorCategory.InvalidData.ToString(), providerName, string.Format(CultureInfo.CurrentCulture, Resources.Messages.InvalidFileType, providerName, fileTypes)); return Enumerable.Empty<PackageProvider>(); } } var providers = isPathRooted ? ImportPackageProviderViaPath(request, providerName, requiredVersion, minimumVersion, maximumVersion, force) : ImportPackageProviderViaName(request, providerName, requiredVersion, minimumVersion, maximumVersion, force); return providers; }
public bool RequirePackageProvider(string requestor, string packageProviderName, string minimumVersion, IHostApi hostApi) { // check if the package provider is already installed if (_packageProviders.ContainsKey(packageProviderName)) { var current = _packageProviders[packageProviderName].Version; if (current >= minimumVersion) { return(true); } } var currentCallCount = hostApi.CallCount; if (_lastCallCount >= currentCallCount) { // we've already been here this call. // are they asking for the same provider again? if (_providersTriedThisCall.Contains(packageProviderName)) { hostApi.Debug("Skipping RequirePackageProvider -- tried once this call previously."); return(false); } // remember this in case we come back again. _providersTriedThisCall.Add(packageProviderName); } else { _lastCallCount = currentCallCount; _providersTriedThisCall = new HashSet <string> { packageProviderName }; } if (!hostApi.IsInteractive) { hostApi.Debug("Skipping RequirePackageProvider due to not interactive"); // interactive indicates that the host can respond to queries -- this doesn't happen // in powershell during tab-completion. return(false); } // no? // ask the bootstrap provider if there is a package provider with that name available. var bootstrap = _packageProviders["Bootstrap"]; if (bootstrap == null) { hostApi.Debug("Skipping RequirePackageProvider due to missing bootstrap provider"); return(false); } var pkg = bootstrap.FindPackage(packageProviderName, null, minimumVersion, null, hostApi).OrderByDescending(p => p, SoftwareIdentityVersionComparer.Instance).GroupBy(package => package.Name).ToArray(); if (pkg.Length == 1) { // Yeah? Install it. var package = pkg[0].FirstOrDefault(); var metaWithProviderType = package.Meta.FirstOrDefault(each => each.ContainsKey("providerType")); var providerType = metaWithProviderType == null ? "unknown" : metaWithProviderType.GetAttribute("providerType"); var destination = providerType == "assembly" ? (AdminPrivilege.IsElevated ? SystemAssemblyLocation : UserAssemblyLocation) : string.Empty; var link = package.Links.FirstOrDefault(each => each.Relationship == "installationmedia"); var location = string.Empty; if (link != null) { location = link.HRef.ToString(); } // what can't find an installationmedia link? // todo: what should we say here? if (hostApi.ShouldBootstrapProvider(requestor, package.Name, package.Version, providerType, location, destination)) { var newRequest = hostApi.Extend <IHostApi>(new { GetOptionValues = new Func <string, IEnumerable <string> >(key => { if (key == "DestinationPath") { return(new[] { destination }); } return(new string[0]); }) }); var packagesInstalled = bootstrap.InstallPackage(package, newRequest).LastOrDefault(); if (packagesInstalled == null) { // that's sad. hostApi.Error(Constants.Messages.FailedProviderBootstrap, ErrorCategory.InvalidOperation.ToString(), package.Name, hostApi.FormatMessageString(Constants.Messages.FailedProviderBootstrap, package.Name)); return(false); } // so it installed something // we must tell the plugin loader to reload the plugins again. LoadProviders(hostApi); return(true); } } return(false); }
private IEnumerable<PackageProvider> ImportPackageProviderViaName(IHostApi request, string providerName, Version requiredVersion, Version minimumVersion, Version maximumVersion, bool force, bool throwErrorWhenImportWithName) { request.Debug(string.Format(CultureInfo.CurrentCulture, "Calling ImportPackageProviderViaName. providerName = '{0}', requiredVersion='{1}', minimumVersion = '{2}', maximumVersion='{3}'", providerName, requiredVersion, minimumVersion, maximumVersion)); //Check if the module or assembly is already loaded //key = path, value = version HashSet<KeyValuePair<string, FourPartVersion>> refreshingProvidersPaths = new HashSet<KeyValuePair<string, FourPartVersion>>(); foreach (var provider in _packageProviders) { if (provider.Key.IsWildcardMatch(providerName)) { //found the provider with the same name is already loaded if (force) { // if -force is present and required version is specified, we will enforce that the loaded provider version must match the required version if ((requiredVersion != null && provider.Value.Version == (FourPartVersion)requiredVersion) // if -force is specified and no version information is provided, we will re-import directly from the path of the loaded provider ||(requiredVersion == null && maximumVersion == null && minimumVersion == null)) { refreshingProvidersPaths.Add(new KeyValuePair<string, FourPartVersion>(_packageProviders[provider.Key].ProviderPath, _packageProviders[provider.Key].Version)); } request.Verbose(string.Format(CultureInfo.CurrentCulture, Resources.Messages.ReImportProvider, provider.Key)); } else { request.Verbose(string.Format(CultureInfo.CurrentCulture, Resources.Messages.ProviderImportedAlready, provider.Key)); return Enumerable.Empty<PackageProvider>(); } } } //reload the assembly foreach (var providerPath in refreshingProvidersPaths) { var providers = ImportPackageProviderViaPath(request, providerPath.Key, providerPath.Value, minimumVersion, maximumVersion, force); return providers; } IEnumerable<PackageProvider> results = null; // if user doesn't have all the available providers in the cache, // then there is a chance that we will miss the latest version of the provider // so we will only try to search from the cache table without refreshing it // if the user does not provide -force and either maximum or minimum version. if (!force || (maximumVersion == null && minimumVersion == null)) { //check if the provider is in the cache table results = FindMatchedProvidersFromInternalCacheTable(request, providerName, requiredVersion, minimumVersion, maximumVersion, force).ToArray(); if (results.Any()) { return results; } } //If the provider is not in the cache list, rescan for providers ScanForAvailableProviders(request, providerName, requiredVersion, minimumVersion, maximumVersion, true, false); results = FindMatchedProvidersFromInternalCacheTable(request, providerName, requiredVersion, minimumVersion, maximumVersion, force).ToArray(); if (!results.Any()) { if (throwErrorWhenImportWithName) { request.Error(Constants.Messages.NoMatchFoundForCriteria, ErrorCategory.InvalidData.ToString(), providerName, string.Format(CultureInfo.CurrentCulture, Resources.Messages.NoMatchFoundForCriteria, providerName)); } else { request.Verbose(string.Format(CultureInfo.CurrentCulture, Resources.Messages.NoMatchFoundForCriteria, providerName)); } } else { return results; } return Enumerable.Empty<PackageProvider>(); }
/// <summary> /// This initializes the provider registry with the list of package providers. /// (currently a hardcoded list, soon, registry driven) /// </summary> /// <param name="request"></param> internal void LoadProviders(IHostApi request) { if (request == null) { throw new ArgumentNullException("request"); } var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var providerAssemblies = (_initialized ? Enumerable.Empty <string>() : _defaultProviders) .Concat(GetProvidersFromRegistry(Registry.LocalMachine, "SOFTWARE\\MICROSOFT\\ONEGET")) .Concat(GetProvidersFromRegistry(Registry.CurrentUser, "SOFTWARE\\MICROSOFT\\ONEGET")) .Concat(AutoloadedAssemblyLocations.SelectMany(location => { if (Directory.Exists(location)) { return(Directory.EnumerateFiles(location).Where(each => !IsExcluded(each) && (each.EndsWith(".exe", StringComparison.CurrentCultureIgnoreCase) || each.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase)))); } return(Enumerable.Empty <string>()); })); #if DEEP_DEBUG providerAssemblies = providerAssemblies.ToArray(); foreach (var each in providerAssemblies) { request.Debug("possible assembly: {0}".format(each)); } #endif // find modules that have manifests // todo: expand this out to validate the assembly is ok for this instance of OneGet. providerAssemblies = providerAssemblies.Where(each => Manifest.LoadFrom(each).Any(manifest => Swidtag.IsSwidtag(manifest) && new Swidtag(manifest).IsApplicable(new Hashtable()))); // add inbox assemblies (don't require manifests, because they are versioned with the core) #if !COMMUNITY_BUILD // todo: these should just be strong-named references. for now, just load them from the same directory. providerAssemblies = providerAssemblies.Concat(new[] { Path.Combine(baseDir, "Microsoft.OneGet.MetaProvider.PowerShell.dll"), Path.Combine(baseDir, "Microsoft.OneGet.ArchiverProviders.dll"), Path.Combine(baseDir, "Microsoft.OneGet.CoreProviders.dll"), Path.Combine(baseDir, "Microsoft.OneGet.MsuProvider.dll"), #if !CORE_CLR // can't load these providers here. Path.Combine(baseDir, "Microsoft.OneGet.MsiProvider.dll"), #endif }); #endif #if DEEP_DEBUG providerAssemblies = providerAssemblies.ToArray(); foreach (var each in providerAssemblies) { request.Debug("possible assembly with manifest: {0}".format(each)); } #endif providerAssemblies = providerAssemblies.OrderByDescending(each => { try { // try to get a version from the file first return((ulong)(FourPartVersion)FileVersionInfo.GetVersionInfo(each)); } catch { // otherwise we can't make a distinction. return((ulong)0); } }); providerAssemblies = providerAssemblies.Distinct(new PathEqualityComparer(PathCompareOption.FileWithoutExtension)); #if BEFORE_WE_HAD_MANIFESTS // hack to make sure we don't load the old version of the nuget provider // when we have the ability to examine a plugin without dragging it into the // primary appdomain, this won't be needed. FourPartVersion minimumnugetversion = "2.8.3.6"; providerAssemblies = providerAssemblies.Where(assemblyFile => { try { if ("nuget-anycpu".EqualsIgnoreCase(Path.GetFileNameWithoutExtension(assemblyFile)) && ((FourPartVersion)FileVersionInfo.GetVersionInfo(assemblyFile)) < minimumnugetversion) { return(false); } } catch { } return(true); }); #endif // there is no trouble with loading providers concurrently. #if DEBUG providerAssemblies.SerialForEach(providerAssemblyName => { #else providerAssemblies.ParallelForEach(providerAssemblyName => { #endif try { request.Debug(request.FormatMessageString("Trying provider assembly: {0}", providerAssemblyName)); if (TryToLoadProviderAssembly(providerAssemblyName, request)) { request.Debug(request.FormatMessageString("SUCCESS provider assembly: {0}", providerAssemblyName)); } else { request.Debug(request.FormatMessageString("FAILED provider assembly: {0}", providerAssemblyName)); } } catch { request.Error(Constants.Messages.ProviderPluginLoadFailure, ErrorCategory.InvalidOperation.ToString(), providerAssemblyName, request.FormatMessageString(Constants.Messages.ProviderPluginLoadFailure, providerAssemblyName)); } }); }