I marked the postition were the exeption is thrown.
This is my Stacktrace:
System.InvalidCastException: Specified cast is not valid.
at ASP.PageViewsMacroPartialsDefaultImageTeaserMacrocshtml.Execute() in c:\Dev\PGM\trunk.NET\Orca.Homepage.Web\Views\MacroPartials\DefaultImageTeaserMacro.cshtml:line 5
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult)
at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content)
at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, INode node)
at umbraco.macro.LoadPartialViewMacro(MacroModel macro)
at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(macro m, IDictionary2 parameters, page umbracoPage)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(String alias, IDictionary2 parameters, page umbracoPage)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(String alias, IDictionary2 parameters)
at Umbraco.Web.UmbracoHelper.RenderMacro(String alias, Object parameters)
at ASP._Page_Views_MacroPartials_Slider_cshtml.Execute() in c:\Dev\PGM\trunk\.NET\Orca.Homepage.Web\Views\MacroPartials\Slider.cshtml:line 18
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult)
at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content)
at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, INode node)
at umbraco.macro.LoadPartialViewMacro(MacroModel macro)
at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(macro m, IDictionary2 parameters, page umbracoPage)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(String alias, IDictionary2 parameters, page umbracoPage)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(String alias, IDictionary2 parameters)
at Umbraco.Web.UmbracoHelper.RenderMacro(String alias, IDictionary`2 parameters)
at ASP.PageViewsPartialsgrideditorsmacrocshtml.Execute() in c:\Dev\PGM\trunk.NET\Orca.Homepage.Web\Views\Partials\Grid\Editors\Macro.cshtml:line 13
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model)
at ASP.PageViewsPartialsgrideditorsbase_cshtml.Execute() in c:\Dev\PGM\trunk.NET\Orca.Homepage.Web\Views\Partials\Grid\Editors\Base.cshtml:line 19
I decompiled the throwing method it looks like this:
public override void ExecutePageHierarchy()
{
if (WebPageHttpHandler.ShouldGenerateSourceHeader(this.Context))
{
try
{
string virtualPath = this.VirtualPath;
if (virtualPath != null)
{
string str = this.Context.Request.MapPath(virtualPath);
if (!str.IsEmpty())
this.PageContext.SourceFiles.Add(str);
}
}
catch
{
}
}
TemplateStack.Push(this.Context, (ITemplateFile) this); //Think throwed here
try
{
this.Execute();
}
finally
{
TemplateStack.Pop(this.Context);
}
}
For my opinion it only can throw the exeption on the marked line but "this" is implementing "ITemplateFile".
The error occured on a fresh umbraco installation.
It would appear that whatever is returned by Umbraco.TypedContent(Model.MacroParameters["TeaserId"]) is not in fact a Teaser, so cannot be cast as such.
Is this at all possible with your document type setup?
InvalidCastException in Macro in Method ExecutePageHierarchy
Hello,
i have two nested Macros. The first one is this:
the second Macro ist nested in the first one and looks like this:
I marked the postition were the exeption is thrown.
This is my Stacktrace:
I decompiled the throwing method it looks like this:
For my opinion it only can throw the exeption on the marked line but "this" is implementing "ITemplateFile".
The error occured on a fresh umbraco installation.
Anyone some ideas?
Thanks a lot,
Niklas
Hi Niklas,
It would appear that whatever is returned by
Umbraco.TypedContent(Model.MacroParameters["TeaserId"])
is not in fact aTeaser
, so cannot be cast as such.Is this at all possible with your document type setup?
Steven.
Thanks for response!
This is also not working:
It throws the same error, don't know why.
Hope this is not a big problem :(
Niklas
is working on a reply...