Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
An object reference is required for the non-static field, method, or property 'MetaData.Current'
After updating a v7 site from v2.2.1 -> 2.2.5 I get this error - I'm sure it's something obvious but I'm drawing a blank!
Steve
Hi Steve,
Do you have a call stack?
Best,
Richard
Here's what i have in the log. I haven't tried debugging it.
2021-06-23 10:11:51,096 [P328/D2/T10] INFO xxx.Core.Utilities.ExtensionMethods - Node: 1057 Exception: C:\data\repos\xxxx_v7\xxxx_v7\Views\Master.cshtml(20): error CS0120: An object reference is required for the non-static field, method, or property 'MetaData.Current' - StackTrace: at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) at System.Web.WebPages.BuildManagerWrapper.CreateInstanceOfType[T](String virtualPath) at System.Web.WebPages.VirtualPathFactoryExtensions.CreateInstance[T](IVirtualPathFactory factory, String virtualPath) at System.Web.WebPages.VirtualPathFactoryManager.CreateInstanceOfType[T](String virtualPath) at System.Web.WebPages.VirtualPathFactoryExtensions.CreateInstance[T](IVirtualPathFactory factory, String virtualPath) at System.Web.WebPages.WebPageBase.CreatePageFromVirtualPath(String virtualPath, HttpContextBase httpContext, Func`2 virtualPathExists, DisplayModeProvider displayModeProvider, IDisplayMode displayMode) at System.Web.WebPages.WebPageBase.<>c__DisplayClass40_0.<RenderPageCore>b__0(TextWriter writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) at System.Web.WebPages.WebPageBase.PopContext() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.WebPages.WebPageBase.<>c__DisplayClass40_0.<RenderPageCore>b__0(TextWriter writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) at System.Web.WebPages.WebPageBase.PopContext() 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.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.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__DisplayClass3_6.<BeginInvokeAction>b__4() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult)
It comes from the view, how do you call the SEOChecker property?
Hi,
In the master template whomever has set this up has just used
@using SEOChecker.Library
Then uses the static to output keywords etc... @MetaData.Current.Keywords
When I update the nuget package this stops working. Can't see anything that's changed other than the SEOChecker code?
What would be the recommended way to get the keywords etc?
That should have gone wrong in the previous version as well.
Syntax is
@{ var seo = Model.Value("your seochecker property alias") as SEOChecker.MVC.MetaData; } @seo.AllTags
Hope this helps,
Weird - I wonder if the dev has buried some static that I can't find that does this on start up... never mind - thanks for the response.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
An object reference is required for the non-static field, method, or property 'MetaData.Current'
An object reference is required for the non-static field, method, or property 'MetaData.Current'
After updating a v7 site from v2.2.1 -> 2.2.5 I get this error - I'm sure it's something obvious but I'm drawing a blank!
Steve
Hi Steve,
Do you have a call stack?
Best,
Richard
Here's what i have in the log. I haven't tried debugging it.
It comes from the view, how do you call the SEOChecker property?
Hi,
In the master template whomever has set this up has just used
@using SEOChecker.Library
Then uses the static to output keywords etc... @MetaData.Current.Keywords
When I update the nuget package this stops working. Can't see anything that's changed other than the SEOChecker code?
What would be the recommended way to get the keywords etc?
That should have gone wrong in the previous version as well.
Syntax is
Hope this helps,
Richard
Hi,
Weird - I wonder if the dev has buried some static that I can't find that does this on start up... never mind - thanks for the response.
Steve
is working on a reply...