Disabled Theme overriding route and controller?

Topics: Core, Customizing Orchard, Troubleshooting, Writing themes
Mar 28, 2012 at 11:07 PM
Edited Mar 29, 2012 at 1:19 AM
  • I have a copy of the Orchard Framework source code with the Core Shapes module.
  • I have three modules I've created myself, no other modules
  • I have a default theme I've created
  • I have an override theme that inherits from the default theme, that I've created
  • The override theme will replace:
    • Layout.cshtml from the default theme
    • A controller from one of the modules
    • Routing from one of the modules
  • The override theme is disabled


//does not return the override theme when called from ShapeTemplateBindingStrategy


The Problem

Orchard is not rendering layout.cshtml from the override theme... as expected.

It is loading the override themes route into the System.Routing.Routes. When I browse to the route contributed from the override theme it executes the controller from the override theme, not the module? ... *not* expected.

Is this a bug? By design? Am I doing something silly? (Its happened before).

Thank you!

Mar 29, 2012 at 3:02 AM
Edited Mar 29, 2012 at 3:02 AM

UPDATE: It appears to be by design:

DynamicExtensionLoader pulls all the exported types from the run-time compiled theme and ShellContainerFactory registers all the dependencies:


        protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
            if (Disabled)
                return null;

            Logger.Information("Start loading pre-compiled extension \"{0}\"", descriptor.Name);

            var assembly = _assemblyProbingFolder.LoadAssembly(descriptor.Id);
            if (assembly == null)
                return null;

            Logger.Information("Done loading pre-compiled extension \"{0}\": assembly name=\"{1}\"", descriptor.Name, assembly.FullName);

            return new ExtensionEntry {
                Descriptor = descriptor,
                Assembly = assembly,
                ExportedTypes = assembly.GetExportedTypes()



PrecompiledExtensionLoader appears to do the same. CoreExtensionLoader filters exported types by namespace (to be expected as its a module of modules).


However, ShapeTemplateBindingStrategy only loads view files (aspx or cshtml) if their owning feature is enabled?



        private bool FeatureIsEnabled(FeatureDescriptor fd) {
            return (DefaultExtensionTypes.IsTheme(fd.Extension.ExtensionType) && (fd.Id == "TheAdmin" || fd.Id == "SafeMode")) ||
                _shellDescriptor.Features.Any(sf => sf.Name == fd.Id);

Is there some filtering of dependencies that happens between DynamicExtensionLoader and ShellContainerFactory that I haven't spotted?

If I disable the theme it will still load its dependencies (including routes and controllers). I think modules will behave in the same way.

Is there a reason why Orchard does this?