mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Features with no code should be loaded successfully
Simply return a feature with no exported types instead of failing. The system is currently built with the assumption that if an extension is active, then any of its feature can be activated/loaded. --HG-- branch : dev
This commit is contained in:
@@ -92,8 +92,14 @@ namespace Orchard.Environment.Extensions {
|
||||
throw new ArgumentException(T("Feature {0} was not found in any of the installed extensions", featureName).ToString());
|
||||
|
||||
var extension = LoadedExtensions().Where(x => x.Descriptor.Name == extensionName).FirstOrDefault();
|
||||
if (extension == null)
|
||||
throw new InvalidOperationException(T("Extension {0} is not active", extensionName).ToString());
|
||||
if (extension == null) {
|
||||
// If the feature could not be compiled for some reason,
|
||||
// return a "null" feature, i.e. a feature with no exported types.
|
||||
return new Feature {
|
||||
Descriptor = featureDescriptor,
|
||||
ExportedTypes = Enumerable.Empty<Type>()
|
||||
};
|
||||
}
|
||||
|
||||
var extensionTypes = extension.ExportedTypes.Where(t => t.IsClass && !t.IsAbstract);
|
||||
var featureTypes = new List<Type>();
|
||||
|
Reference in New Issue
Block a user