This project is read-only.

What??? Projection/Query List Gone!

Topics: Customizing Orchard, General, Writing modules, Writing themes
Nov 22, 2013 at 7:43 PM
Edited Nov 22, 2013 at 7:47 PM
Okay, I'm really not sure what the hell I just did, but I have been reading through Bertrands articles on customizing list display:

And I was using Shape Tracing to look at the layout for a Projection I created. I'm trying to get rid of the bullet points. When I looked at the page with the projection, it indicated that there were a couple of Alternates. I clicked on one of them (I'm using the "Floral Orange One" Theme), and it wiped out the entire list. Nothing displays!

I tried several others (the original doesn't show up as an alternative), and nothing worked. I then went back to the Dashboard, and tried to list the Contents, thinking I just needed to remove and recreate the Projection. The list of Contents is gone!

If I select Content Definition, Content Types is empty, but Content Parts is displaying everything.

I changed themes (Bootstrap), and now the Projection displays, but the Content/Content Types lists are still empty.

What the hell????

Short of re-installing Orchard (really not an option at this point), how do I recover from this? What happened? How do I make sure it doesn't happen in the future? That's a hell of a consequence for clicking on a link to see an alternative list layout. Is this a general Orchard issue or a particular problem with Themes?

Please let me know how to recover from this as soon as possible. This is a big problem, as I can't move forward on a couple of different fronts until I get this resolved.

Edit: On taking a closer look, it has also wiped out the list of recent posts that I am displaying in the AsideSecond on the right.
Nov 22, 2013 at 8:01 PM
It's hard to say what the cause of the issue is without looking at your installation or log files. So the best advice at this point is to look into the Log files and see if errors are occurring. Stuff not displaying usually indicates errors in drivers. If you need help analyzing the logs, please feel free to paste the contents here.
Nov 22, 2013 at 8:06 PM
Same essential message in both the error and debug logs:

2013-11-22 14:17:32,876 [12] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
__System.IO.IOException: The process cannot access the file 'C:\Development\Orchard.Source.1.7.1\src\Orchard.Web\Themes\FloralOrangeOne\Views\List.cshtml' because it is being used by another process.
__ at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Web.Hosting.MapPathBasedVirtualFile.Open()
at Orchard.FileSystems.VirtualPath.DefaultVirtualPathProvider.OpenFile(String virtualPath) in c:\Development\Orchard.Source.1.7.1\src\Orchard\FileSystems\VirtualPath\DefaultVirtualPathProvider.cs:line 107
at Orchard.FileSystems.WebSite.WebSiteFolder.CopyFileTo(String virtualPath, Stream destination, Boolean actualContent) in c:\Development\Orchard.Source.1.7.1\src\Orchard\FileSystems\WebSite\WebSiteFolder.cs:line 90
at Orchard.FileSystems.WebSite.WebSiteFolder.CopyFileTo(String virtualPath, Stream destination) in c:\Development\Orchard.Source.1.7.1\src\Orchard\FileSystems\WebSite\WebSiteFolder.cs:line 74
at Orchard.DesignerTools.Controllers.AlternateController.Create(String template, String alternate, String returnUrl)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

So there is essentially a file lock on List.cshtml. Is there a way to undo that? Should I just reboot Windows?
Nov 22, 2013 at 8:08 PM
Yes, please try and let us know if that helped or not.
Nov 22, 2013 at 8:09 PM
Or just try recycling the application pool first.
Nov 22, 2013 at 8:23 PM
Nope. Neither worked.

Interesting, though--neither log file has been updated with any new messages. Even though the display issue is still occurring.


Thanks for jumping into this, by the way. I've been getting deeper and deeper into Orchard, and I keep referring back to your tutorials. I've found some interesting gaps in the discussion that may be worth fleshing out, but the general focus and technical understanding you bring to the topics have been a huge help.
Nov 22, 2013 at 8:37 PM
Quick update: I've been switching themes, to see what happens. A couple of themes correct the issue with my custom Projection. But none of them handle the admin-side errors.
Nov 22, 2013 at 8:55 PM
Thanks, man, appreciate that. And you're welcome.
At this point all I can do is really advise trying things such as clearing all binaries and rebuilding the solution, setting up a new instance just to see if you can reproduce the issue. Because if you can, you can file an issue and we will look into it (eventually I should add).
Nov 22, 2013 at 8:56 PM
And clear App_Data (except the SqlCe database if you're using that).
Nov 23, 2013 at 12:24 AM
sfmskywalker wrote:
And clear App_Data (except the SqlCe database if you're using that).
Everything? Including all of the DLLs in /Dependencies and /Sites?

I ran "Clean Solution" and "Rebuild All", to no avail. As soon as you confirm what should be deleted from /App_Data, I'll try that out and see what happens.

I'm really not thrilled about the idea of doing a fresh install of Orchard. Trying to recreate everything could be ... problematic. I've got a recent backup, though, so maybe what I'll do is back up just the source o what I worked on today and then revert everything else. Seems like that could clear things up.
Nov 23, 2013 at 12:57 AM
Well, that didn't work out well. I deleted everything inside of /App_Data, and then rebuilt the app. When I ran it, I had to re-establish the connection to the db (which is running on Windows Azure), but now the default Orchard website is running. And I still can't get to the Content portion of the Admin console, so I can't change it back to my home page.

I'm going to call it a night. I think I'm going to have to bite the bullet and rebuild the app from scratch. I've got all the code backed up, but it's going to take time to get it all configured properly. I really didn't want to go that route, but it looks like I have no choice.

It'd sure be nice if I knew what happened in the first place. Since I'm going down the tunnel of re-installing everything, I may try to recreate the bug for you guys. If I have any luck, I'll post an update here.
Nov 23, 2013 at 1:39 PM
Really sorry to hear about your troubles. Please do let us know if you are able to reproduce the issue.
I should have mentioned to always make a backup before you delete anything. When deleting App_Data, it's safe to delete everything except Settings.txt and your SqlCe DB, if any. Loosing Settings.txt is not the end of the world, but if you don't want to re-setup Orchard, you will have to set the State to Running and the DataConnectionString and DataProvider to the proper values. Having a copy of Settings.txt eases that.
Nov 25, 2013 at 2:33 AM
Okay. I've recovered, I think. I ended up deleting the original Theme and then downloading and installing it again. Things were still a bit wacky, but all of the content was showing up. However, I had duplicate menu bars and asides. I had to go through the Navigation and Widgets managers and remove a bunch of dupes. But I've finally got it so that it is looking right.

Which finally gets me back to my original state, and brings up the reason why I did this all to begin with--I have a Projection with some bullet points that I'd like to remove. I was reading through Bertrand's article, but I'm really not sure how to do it. It seem like I just need to modify the CSS that is styling the Projection, but I can't tell how to do that. Is there an easy way to manage this?
Nov 25, 2013 at 4:23 AM
I'm thinking removing those alternate files from the theme would have unblocked you from the start.
Nov 25, 2013 at 4:25 PM
BertrandLeRoy wrote:
I'm thinking removing those alternate files from the theme would have unblocked you from the start.
That makes sense. Still feeling my way around the massiveness that is Orchard!
Nov 26, 2013 at 1:16 PM
BertrandLeRoy wrote:
I'm thinking removing those alternate files from the theme would have unblocked you from the start.
Okay. It just happened again. Here are the steps:
  1. I created a new Projection;
  2. went to the page to view it;
  3. opened up Shape Tracing;
  4. selected the list;
  5. selected ~/Themes/FloralOrangeOne/Views/List.cshtml from the alternates.
Gone. All of my lists are gone. I went back into Shape Tracing and selected the area of the list again, and clicked on "~/Themes/FloralOrangeOne/Views/List.cshtml", and received the following message:

"Content not available as coming from source code."

Which brings me to the question--how do I remove the file if it is code generated? Is there actually supposed to be a List.cshtml file in the /Views folder for FloralOrangeOne, which is the source of this problem? Since no cshtml file actually exists there (I looked), is that why everything has been nuked? Should I dump a basic template there to get this back in shape?

And why is this causing problems for the layout of the rest of Orchard, as spelled out above? There seems to be a pretty serious design flaw in here somewhere, if this is happening. How can modifying the layout for a particular Projection have such far-reaching, and negative impact of the rest of the app?

Please advise. This is not a happy situation.
Nov 26, 2013 at 2:10 PM
An Update: I did a little digging, and am seeing some interesting things. I don't know enough about the guts of Orchard to know if what I'm seeing is the way things are supposed to be, but I'll spell it out and you guys can tell me if I may be on to something.

I dug into the Themes folder under the Orchard solution. I found that the only themes in the Themes project are SafeMode, TheAdmin, and TheThemeMachine. I then looked into the actual directory structure in File Manager, and lo-and-behold--there is /FloralOrangeOne! And, in fact, there is a List.cshtml file in the /Views folder under /FloralOrangeOne. It is an empty file.

Sooo ... I added FloralOrangeOne to the Themes project. I then edited List.cshtml and dropped in this code:
@using Orchard.ContentManagement;
    IEnumerable<object> blogPosts =
@if (blogPosts == null || blogPosts.Count() < 1) {
<p>@T("No posts.")</p>
else {
    <ul class="content-items">
    @foreach (dynamic post in blogPosts) {
        string title = post.Title;
        ContentItem item = post.ContentItem;
        <li class="content-item-summary">
            @Html.ItemDisplayLink(title, item)
I pulled this from here:

The first time I ran this, I got all kinds of stack dumps, as apparently Orchard didn't like this:
 IEnumerable<object> blogPosts =
When I ran it through the debugger, and looked at that line, I could not see any ContentItems property on Model, much less on Model.ContentItems. If I removed the second ContentItems, the app would run, but I'd get a couple of "No posts." on the page (including where I've got a widget displaying the latest blog posts, which normally has a couple of items in it).

I'm not quite sure where to go from here. Obviously, the List.cshtml template code is being called. But the Model doesn't appear to be populated with the appropriate ContentItems, so nothing is being displayed. Bertrand, you indicate above that if I remove the List.cshtml file, that things should go back to normal. I'm going to try that next and see what happens. But that still leaves me with -- what happened in the first place, and are my explorations revealing anything of import to the situation?
Nov 26, 2013 at 2:35 PM
Okay. I'm making progress. And I'm seeing things that you guys may want to dig into.

First: I deleted List.cshtml, and that did, in fact, clear up the problem.

I then went through the same process and selected a different alternative (List-5925.cshtml). I had a somewhat similar problem, in that my projections disappeared. But, the recent blog posts list stayed the same.

A-hah! Holmes is on the scent! ;-)

I dug into the blog widget, and got to ~/Modules/Orchard.Blogs/Views/Parts.Blogs.RecentBlogPosts.cshtml. When I opened that up, I saw this simple line of code:
Okay. That eventually led me to ... /Views/Blog/List.cshtml!!!!

And I'm willing to bet that quite a few of the Admin pages are managed by similarly named template files. List.cshtml is a default name used in quite a few places. And when that name is used as an alternate template, at least in FloralOrangeOne (and a few others, given what I saw when I switched between themes over the weekend, trying to resolve this), it over-rides the template for everything else.

That's a bug, gang. A nasty one, too. Do you need me to file a bug report, and if so, what kind of information do you need? Is there any additional data that I should provide?

Hope this helps in your investigations. Feel free to ping me with questions (or rotten tomatoes; whatever!). And if I'm missing something important, please let me know.
Dec 23, 2013 at 5:37 PM
I haven't heard any response to my updates. To me this appears to be a bug, and I'm more than willing to file a report. But I really don't want to spend the time on it if you're going to reject it. Am I battling ghosts here, or is there substance to my findings? Just let me know either way, and I'll do what's needed.
Dec 23, 2013 at 5:43 PM
GregoryHill wrote:
I haven't heard any response to my updates. To me this appears to be a bug, and I'm more than willing to file a report. But I really don't want to spend the time on it if you're going to reject it. Am I battling ghosts here, or is there substance to my findings? Just let me know either way, and I'll do what's needed.
I would report a bug for it. It would have my vote as I noticed it as well.