Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michal Pandyra 5 posts 25 karma points
    Jan 13, 2021 @ 21:41
    Michal Pandyra
    0

    [SOLVED] Some views suddenly stopped rendering

    TL;DR Solved. The hosting environment stopped generating models on the fly using PureLive mode.

    Switched the ModelsBuilder to Dll mode and manually generated the Models in the ~/App_Data/Models folder using the backoffice Models Builder ( Developer > Models Builder > Generate models )


    Good afternoon,

    I come asking for support as I've exhausted all of my troubleshooting abilities.

    Our production site suddenly started throwing 500 errors overnight and I'm unable to track down the exact cause. Hoping someone better versed with Umbraco could have a second look.

    The TraceLog is filled with this error. Not limited to the "Gallery.cshtml" view:

    2021-01-13 12:29:18,395 [P16736/D20/T194] ERROR Umbraco.Core.UmbracoApplicationBase - An unhandled exception occurred System.InvalidOperationException: The view found at '~/Views/Gallery.cshtml' was not created.
    

    There have been no changes to the codebase since 2018 or 2019, so I suspect something might have changed on the hosting environment, but I'm not entirely convinced it isn't some kind of previously uncaught issue in the code.

    I've trolled the forums for similar incidents, but I haven't been able to find an instance where Umbraco.Core.UmbracoApplicationBase appears in combination with System.InvalidOperationException

    System Health Check doesn't return any errors.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Gallery>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "master.cshtml";
    }
    
    <!-- mike was here -->
    

    I've confirmed that there is an "Gallery" page template created in the Umbraco backoffice. If I remove the two top lines the View renders correctly.

    Unfortunately, I don't have access to the original development environment for this project and can't run further debugging through VS.

    Thanks in advance to anyone who can provide a helping hand!

  • Amir Khan 1287 posts 2744 karma points
    Jan 13, 2021 @ 21:46
    Amir Khan
    0

    Is it possible that the permissions got messed up on your hosting environment?

  • Michal Pandyra 5 posts 25 karma points
    Jan 14, 2021 @ 00:15
    Michal Pandyra
    0

    Would I be looking at the permissions of any folder/file in particular? At a glance file ownership and permissions appear to be OK.

    I had a quick look through the various View files and everything looks sound, unless there are other core Umbraco files that might be affected elsewhere?

    The hosting provider claims there were no changes made to the environment at the time that the errors started occurring.

    Is there any way to discern with more detail where the stack trace is hitting this uncaught exception?

    Here's a full copy/paste of an example (this time a different page template from the one used in my previous example, but the trace is the same)

    2021-01-13 11:57:09,867 [P16736/D19/T80] ERROR Umbraco.Core.UmbracoApplicationBase - An unhandled exception occurred
    System.InvalidOperationException: The view found at '~/Views/ProductCategory.cshtml' was not created.
       at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
       at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
       at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
       at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
       at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
       at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    

    I'm not seeing RenderBody() being called, so I at least suspect it might be a partial?

  • Amir Khan 1287 posts 2744 karma points
    Jan 14, 2021 @ 15:13
    Amir Khan
    0

    So this line here, assuming its in this other file also, tells me its likely a template and not a partial: Layout = "master.cshtml";

    Here are the file permissions you want to check for, I've definitely had issues with a host where these were mysteriously updated and broke a site: https://our.umbraco.com/documentation/getting-started/setup/server-setup/permissions

    Another thing you could try is clearing the app_data/temp folder and see if that helps.

  • Michal Pandyra 5 posts 25 karma points
    Jan 14, 2021 @ 16:53
    Michal Pandyra
    0

    Firstly, Thank you for your suggestion. I've gone through some additional troubleshooting steps, including those you provided, but here has been no improvement.

    Secondly, Sorry for the confusion.

    Correct, these are template files for specific page types on the site. What I was trying to explain is that the master template itself works fine. Some of the page types render correctly. I thought perhaps because the stack trace includes a "Render" call, that the issue might be related to calling a partial within the template.

    I've worked through the handful of files, plugging away at the code trying to narrow the cause. Here's what I've found.

    This doesn't work:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Gallery>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "master.cshtml";
    }
    
    <!-- mike was here -->
    

    This does work:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = "master.cshtml";
    }
    
    <!-- mike was here -->
    
  • Michal Pandyra 5 posts 25 karma points
    Jan 14, 2021 @ 17:15
    Michal Pandyra
    0

    Further to my last post, it definitely has something to do with using the strongly typed syntax on the first line.

    When I include the Model class with @inherit it causes the error. The same applies to both UmbracoTemplatePage as well as UmbracoViewPage

  • Amir Khan 1287 posts 2744 karma points
    Jan 14, 2021 @ 17:16
    Amir Khan
    0

    Did you try rebuilding your models or seeing of somehow modelsbuilder was disabled in your webconfig?

  • Michal Pandyra 5 posts 25 karma points
    Jan 14, 2021 @ 17:48
    Michal Pandyra
    0

    Hi Amir,

    Thanks for the support. I had a look and the App_Data/Models folder did look a bit empty.

    web.config showed that the ModelsBuilder was on, but it was in PureLive mode. I changed it to Dll and generated the models manually.

    Site appears to be back up and running. I'll review in further detail, but I wouldn't have bene able to get there without your insight.

  • Steve Smith 75 posts 158 karma points
    Apr 15, 2021 @ 10:03
    Steve Smith
    0

    Just here to say thanks for this thread, as the same thing happened to me this morning on a site we have on shared hosting. Same solution fixed it (changing the mode from PureLive to Dll, and then going to the Models Builder tab to generate the models).

    The site had been running fine for weeks, with no changes (not even content changes) - so its odd that it suddenly stopped working.

Please Sign in or register to post replies

Write your reply to:

Draft