3

Resolved

Styles.Require stopped working on theme's Layout page since pre 1.7

description

branch 1.x - change set: 847c3d59d6be

Fragment of Layout.cshtml of "MyTheme"
    Style.Include("default");
    Style.Require("bootstrap");
    Style.Require("bootstrap-responsive");
    Style.Require("bootstrap-internal");
Default style and bootstrap-internal is defined in ResourceManifest in "MyTheme"
Bootstrap styles are defined in ResourceManifest of my Bootstrap module.

In version 1.5.1 and 1.6 this theme was working correctly. In version 1.7 it doesn't.

Line 257:                var resource = FindResource(settings);
Line 258:                if (resource == null) {
Line 259:                    throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "A '{1}' named '{0}' could not be found.", settings.Name, settings.Type));
Line 260:                }
Line 261:                ExpandDependencies(resource, settings, allResources);


Source File: c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\UI\Resources\ResourceManager.cs    Line: 259

Stack Trace:


[InvalidOperationException: A 'stylesheet' named 'bootstrap' could not be found.]
   Orchard.UI.Resources.ResourceManager.BuildRequiredResources(String resourceType) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\UI\Resources\ResourceManager.cs:259
   Orchard.Core.Shapes.CoreShapes.WriteResources(Object Display, TextWriter Output, String resourceType, Nullable`1 includeLocation, Nullable`1 excludeLocation) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard.Web\Core\Shapes\CoreShapes.cs:386
   CallSite.Target(Closure , CallSite , CoreShapes , Object , TextWriter , String , Object , Object ) +284
   Orchard.Core.Shapes.CoreShapes.StylesheetLinks(Object Display, TextWriter Output) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard.Web\Core\Shapes\CoreShapes.cs:338

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:64
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.<>c__DisplayClass4.<CreateDelegate>b__3(DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:55
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:177
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:81
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:86
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:43
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:29
   CallSite.Target(Closure , CallSite , Object , Object ) +193
   Orchard.Core.Shapes.CoreShapes.DocumentZone(Object Display, Object Shape, TextWriter Output) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard.Web\Core\Shapes\CoreShapes.cs:268

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:64
   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.<>c__DisplayClass4.<CreateDelegate>b__3(DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:55
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:177
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:81
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:86
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:43
   Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:29
   CallSite.Target(Closure , CallSite , Object , Object ) +193
   ASP._Page_Core_Shapes_Views_Document_cshtml.Execute() in c:\Projects\Medicover\Loyalty\src\app\Orchard\Core\Shapes\Views\Document.cshtml:15
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:139
   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.<Discover>b__15(DisplayContext displayContext) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:126
   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:177
   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:95
   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:86
   Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in c:\Projects\Medicover\vendors\orchard\orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:43
   ...

comments

CSADNT wrote May 15, 2013 at 3:13 PM

I have quite same config: a bootstrap module just to references js and css globally and a bootstrap theme, but in mly bootstrap theme I don't have a manifest, puting file in the Theme Styles and Script folders automatically references them.

rodpl wrote May 16, 2013 at 9:16 AM

I've found reason of that situation. Here is more info:

MyBootstrap Module and MyTheme are dynamic loading modules/themes ... they do not have its own bin folder with precompiled own dlls like MyBootstrap.dll and MyTheme.dll

This error occurs when I'm running test orchard from ./build/Stage folder with installed my module and theme.
But error doesn't occur when I'm running test orchard from ./src/Orchard.Web with installed my module and theme.

The difference in both locations is in HostComponents.config

In Stage folder and artifact zip looks like this
    <Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
      <Properties>
        <!-- Set Value="true" to disable source files monitoring -->
        <Property Name="DisableMonitoring" Value="true" />
        <!-- Set Value="true" to completely disable the Dynamic Extension Loader -->
        <Property Name="Disabled" Value="true" />
      </Properties>
    </Component>
in ./src/Orchard.Web
    <Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
      <Properties>
        <!-- Set Value="true" to disable source files monitoring -->
        <Property Name="DisableMonitoring" Value="false"/>
        <!-- Set Value="true" to completely disable the Dynamic Extension Loader -->
        <Property Name="Disabled" Value="false"/>
      </Properties>
    </Component>
Everything seems logical. This is correct situation that when I turn DynamicExtensionLoader off my module and theme won't work ... and that is correct.

The problem is why Stage and MSDeploy and zipped version of Orchard have DynamicExtensionLoader turned off by default. This is breaking change to version 1.6. There is many modules and themes in Orchard Gallery which are not precompiled with its own bin folder.

Problem is in Orchard.proj
    <XmlUpdate XmlFileName="$(StageFolder)\Config\HostComponents.config"
      XPath="/HostComponents/Components/Component[@Type='Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader']/Properties/Property/@Value"
      Value="true" />
This line sets all values from false to true, also disables DynamicExtensionLoader during build process.

sebastienros wrote May 21, 2013 at 11:22 PM

Fixed in changeset 3e12cca26347

sfmskywalker wrote Mar 28 at 1:28 AM

Fixed in changeset 3de95903dc674161b4534d6d173c2084d2c26745