U4-2301 - CurrentPage in Surface controller throws exception

Created by Xander H. 31 May 2013, 06:16:58 Updated by Shannon Deminick 31 May 2013, 07:24:01

Relates to: U4-1844

Code was working fine until i upgraded to from Umbraco v6.0.3 to Umbraco v6.1.0. Exception is thrown when trying to access CurrentPage property of surface controller. Tested with both CurrentPage and RedirectToCurrentUmbracoPage(). Probably related to U4-1844

Exception: InvalidOperationException: Cannot find the Umbraco route definition in the route values, the request must be made in the context of an Umbraco request

Stack trace: [InvalidOperationException: Cannot find the Umbraco route definition in the route values, the request must be made in the context of an Umbraco request] Umbraco.Web.Mvc.SurfaceController.get_CurrentPage() +113 UmbracoTest.Controllers.SurfaceControllers.TestSurfaceController.Index(String username, String email) in e:\UmbracoProject\UmbracoTest\UmbracoTest\Controllers\SurfaceControllers\TestController.cs:44 lambda_method(Closure , ControllerBase , Object[] ) +179 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +261 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +39 System.Web.Mvc.Async.<>c__DisplayClass42.b__41() +34 System.Web.Mvc.Async.<>c__DisplayClass39.b__33() +124 System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +837307 System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +837307 System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +837307 System.Web.Mvc.Async.<>c__DisplayClass37.b__36(IAsyncResult asyncResult) +15 System.Web.Mvc.Async.<>c__DisplayClass2a.b__20() +33 System.Web.Mvc.Async.<>c__DisplayClass25.b__22(IAsyncResult asyncResult) +837892 System.Web.Mvc.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult) +28 System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65 System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51 System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51 System.Web.Mvc.<>c__DisplayClass4.b__3() +15 System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +41 System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1411

[HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.] System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2819 System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +275 System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +94 System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +700 System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +123 ASP._Page_Views_MacroPartials_TestMacro_cshtml.Execute() in e:\umbraco\Views\MacroPartials\TestMacro.cshtml:3 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196 Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult) +226 Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, INode currentPage) +981 umbraco.macro.LoadPartialViewMacro(MacroModel macro) +217 umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId) +3277 umbraco.presentation.templateControls.Macro.CreateChildControls() +1829 System.Web.UI.Control.EnsureChildControls() +189 System.Web.UI.Control.InitRecursive(Control namingContainer) +186 System.Web.UI.Control.AddedControl(Control control, Int32 index) +189 umbraco.presentation.templateControls.<>c__DisplayClass6.b__2(String macroAlias, Dictionary2 attributes) +523 Umbraco.Core.Macros.MacroTagParser.ParseMacros(String text, Action1 textFoundCallback, Action`2 macroFoundCallback) +757 umbraco.presentation.templateControls.ItemRenderer.ParseMacros(Item item) +225 umbraco.presentation.templateControls.ItemRenderer.Load(Item item) +174 umbraco.presentation.templateControls.Item.OnLoad(EventArgs e) +33 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

Comments

Shannon Deminick 31 May 2013, 06:26:55

Please provide steps and code to reproduce?


Xander H. 31 May 2013, 07:22:00

I resolved the issue. I attempted to replicate the problem on a different surface controller and found that it was not occurring there. The wrong template was applied to the content page. I'm so sorry to have wasted your time. You have my sincere apologies. I was so sure that it was the upgrade that caused the issue, and i have no recollection of changing the template for the page.


Shannon Deminick 31 May 2013, 07:24:01

phew! glad it wasn't an issue :)


Priority: Normal

Type: Bug

State: Closed

Assignee: Shannon Deminick

Difficulty: Normal

Category: Extensibility

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.1.0

Due in version:

Sprint:

Story Points:

Cycle: