Puzzling error started cropping up

Feb 11, 2011 at 2:22 AM
Edited Feb 11, 2011 at 2:23 AM

Getting a weird error recently.  This is happening when I try to navigate in the admin panel to the List action in a custom content type in a module.  It was working fine until recently, but the error thrown doesn't seem to make sense as I have not deleted any stylesheets.  Furthermore, I can find a stylesheet named Admin.css in the referenced location.  YSOD is below.

Any insight would be appreciated, thanks.

 

Paul

Server Error in '/' Application.

 

A 'stylesheet' named 'Admin' could not be found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 

Exception Details: System.InvalidOperationException: A 'stylesheet' named 'Admin' could not be found.

 

Source Error: 

 

Line 17:     <meta charset="utf-8" />

Line 18:     <title>@title</title> 

Line 19:     @Display(Model.Head)

Line 20:     <script>(function(d){d.className="dyn"+d.className.substring(6,d.className.length);})(document.documentElement);</script> 

Line 21: </head> 

 

Source File: e:\Sites\mysite\Core\Shapes\Views\Document.cshtml    Line: 19 

 

Stack Trace: 

 

[InvalidOperationException: A 'stylesheet' named 'Admin' could not be found.]

   Orchard.UI.Resources.ResourceManager.BuildRequiredResources(String resourceType) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\UI\Resources\ResourceManager.cs:220

   Orchard.Core.Shapes.CoreShapes.WriteResources(Object Display, TextWriter Output, String resourceType, Nullable`1 includeLocation, Nullable`1 excludeLocation) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard.Web\Core\Shapes\CoreShapes.cs:262

   CallSite.Target(Closure , CallSite , CoreShapes , Object , TextWriter , String , Object , Object ) +403

   Orchard.Core.Shapes.CoreShapes.StylesheetLinks(Object Display, TextWriter Output) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard.Web\Core\Shapes\CoreShapes.cs:220

 

[TargetInvocationException: Exception has been thrown by the target of an invocation.]

   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +639

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38

   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:65

   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55

   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:161

   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:74

   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:71

   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +52

   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +32

   Orchard.Core.Shapes.CoreShapes.DocumentZone(Object Display, Object Shape, TextWriter Output) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard.Web\Core\Shapes\CoreShapes.cs:150

 

[TargetInvocationException: Exception has been thrown by the target of an invocation.]

   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +639

   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38

   Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.ShapeAttributeBindingStrategy.PerformInvoke(DisplayContext displayContext, MethodInfo methodInfo, Object serviceInstance) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:65

   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55

   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:161

   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:74

   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:71

   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +52

   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +32

   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +975

   ASP._Page_Core_Shapes_Views_Document_cshtml.Execute() in e:\Sites\mysite\Core\Shapes\Views\Document.cshtml:19

   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280

   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104

   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +173

   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +158

   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:120

   Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass26.<Discover>b__14(DisplayContext displayContext) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:109

   Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55

   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:161

   Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:83

   Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:71

   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +52

   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +32

   Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.<FindView>b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:58

   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +384

   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +33

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +784900

   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265

   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976

   System.Web.Mvc.Controller.ExecuteCore() +159

   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335

   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62

   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20

   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54

   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Mvc\Routes\ShellRoute.cs:155

   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453

   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371

 

 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Mar 3, 2011 at 8:08 PM

Did you ever resolve this?  I'm experiencing the exact same error.  I installed the Contact Us form module, which creates a custom list, and when I click it I receive the same error as you.

Mar 3, 2011 at 8:22 PM

We did, but I honestly don't recall how.  I seem to think it had something to do with content items that had been deleted improperly (i.e. via the database) and that was  messing up the lookup logic for the list.  

Mar 3, 2011 at 8:56 PM

I resolved this, sort of differently.  CyberStride.Contacts was the module causing the problem, and the CSHTML was requiring a style that did not exist in the module.  I copied the view to my theme, then commented out the offending line.

1: In your theme create Views\CyberStride.Contacts\Admin\index.cshtml (or if you have this problem elsewhere, follow the Views\Module\Controller\view.cshtml pattern)

2: Comment out any CSHTML causing you problems

3: Fix what you broke by commenting out stuff above ;)

This way you are not modifying the original module

Mar 3, 2011 at 10:01 PM

That's interesting.  I'm actually the author of that module, and didn't have a problem w/ the call to Style.Require("Admin"); until after some other stuff happened.  Wild, I can pull it out of the source code pretty easily; I was following the patterns in other modules' views.

Mar 24, 2011 at 10:30 AM

I was getting the same error. I had previously disabled the comments feature and once re-enabled it, the page started working again

Coordinator
Mar 25, 2011 at 1:30 AM

Does someone have reproduction steps? If so, would you mind filing a bug so that we can investigate?

May 24, 2011 at 7:59 PM

I am experiencing similar error on Orchard version 1.1.30

 

System.InvalidOperationException was unhandled by user code
  Message=A 'stylesheet' named 'Account' could not be found.
  Source=Orchard.Framework
  StackTrace:
       at Orchard.UI.Resources.ResourceManager.BuildRequiredResources(String resourceType)
       at Orchard.Core.Shapes.CoreShapes.WriteResources(Object Display, TextWriter Output, String resourceType, Nullable`1 includeLocation, Nullable`1 excludeLocation)
       at CallSite.Target(Closure , CallSite , CoreShapes , Object , TextWriter , String , Object , Object )
       at Orchard.Core.Shapes.CoreShapes.StylesheetLinks(Object Display, TextWriter Output)
  InnerException: 

Coordinator
May 24, 2011 at 8:09 PM

@Tim: I'm guessing you have a custom theme. Can you try to disable that theme and see if it makes a difference?

Jun 1, 2011 at 7:54 PM

I just came across this error today as well using a clean install of Orchard CMS from the Orchard Web Gallery, the default theme not changed, and a custom module I created that I already have working other places.

The Resource Manifest is correctly specifying my script and the script is in the right place, but using Script.Require kept giving me that error. After an hour I just said the heck with it and used Script.Include. Unfortunately, the script had a dependency on jQuery, so I put Script.Require in my part's view for jQuery and it worked fine, but it won't work using Script.Require for my script.

I haven't a clue why the error just started to pop-up today, but my work around is to change Script.Require to Script.Include for my custom scripts until there is a solution for this.

 

Regards,

Dave

Aug 16, 2011 at 8:32 AM
Edited Aug 16, 2011 at 8:33 AM
hectorOfT wrote:

I was getting the same error. I had previously disabled the comments feature and once re-enabled it, the page started working again

that, worked for me too. I had disabled them aswell

May 10, 2013 at 1:54 AM
davidhayden wrote:
but my work around is to change Script.Require to Script.Include
That's what worked for me too. Thank you David.