mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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());
|
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();
|
var extension = LoadedExtensions().Where(x => x.Descriptor.Name == extensionName).FirstOrDefault();
|
||||||
if (extension == null)
|
if (extension == null) {
|
||||||
throw new InvalidOperationException(T("Extension {0} is not active", extensionName).ToString());
|
// 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 extensionTypes = extension.ExportedTypes.Where(t => t.IsClass && !t.IsAbstract);
|
||||||
var featureTypes = new List<Type>();
|
var featureTypes = new List<Type>();
|
||||||
|
|||||||
Reference in New Issue
Block a user