Mediachase.MetaDataPlus.MetaObject.CreateFieldStorage NullPointer exception

Vote:
 

This problem is supposed to be fixed by this: http://world.episerver.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=COM-551

What have I done is:

Upgraded Commerce from 7.12.0 to 9.7.0

Migration seems to finish successfully, but afterwards in following screen -

http://site/cms/Commerce/Catalog#viewsetting=viewlanguage:///nb-NO&context=epi.cms.contentdata:///1073742019__CatalogContent

Example

[NullReferenceException: Object reference not set to an instance of an object.]
   Mediachase.MetaDataPlus.MetaObject.CreateFieldStorage(MetaClass metaClass, Func`2 getValue) +207
   Mediachase.MetaDataPlus.MetaObject..ctor(MetaClass metaClass, Int32 objectId) +29
   Mediachase.Commerce.Catalog.Dto.CatalogNodeRowExtensions.StartDate(CatalogNodeRow catalogNodeRow, MetaDataContext context) +159
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.AddStaticAttributePropertyValues(CatalogNodeRow nodeRow, NodeContent content) +234
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.LoadStaticContentProperties(CatalogNodeRow nodeRow, CatalogItemSeoRow seoRow, NodeContent content) +144
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.LoadProperties(CatalogNodeRow nodeRow, CatalogItemSeoRow seoRow, NodeContent content, MetaObjectAccessor metaObjectAccessor) +176
   EPiServer.Commerce.Catalog.Provider.Construction.NodeBuilder.Create(IList`1 contentLinks, String language) +1130
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc) +774
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language) +606
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader) +234
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector) +624
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContent(ContentReference contentLink, ILanguageSelector languageSelector) +197
   EPiServer.Core.<>c__DisplayClass174_0.b__0() +131
   EPiServer.Core.OptimisticCache`1.Read(String cacheKey, ReadAndCacheObject`1 readAndCacheObject) +811
   EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository(ContentReference contentreference, ILanguageSelector selector) +702
   EPiServer.Core.ProviderPipelineImplementation.GetItem(ContentProvider provider, ContentReference contentLink, LoaderOptions loaderOptions) +332
   EPiServer.Core.DefaultContentLoader.TryGet(ContentReference contentLink, LoaderOptions loaderOptions, T& content) +577
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.TryGetVirtualPath(HttpContextBase context, CatalogContentBase content, String language, String& virtualPath) +520
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.GetPartialVirtualPath(CatalogContentBase content, String language, RouteValueDictionary routeValues, RequestContext requestContext) +446
   EPiServer.Web.Routing.Segments.PartialSegment.GetVirtualPathSegment(RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues) +334
   EPiServer.Web.Routing.ContentRoute.AddVirtualPathFromSegments(StringBuilder virtualPath, RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues, Int32 lastNonDefaultIndex) +111
   EPiServer.Web.Routing.ContentRoute.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +543
   EPiServer.Web.Routing.DefaultUrlResolver.GetUrlFromRoute(ContentReference contentReference, String language, RouteValueDictionary routeValues, RequestContext requestContext) +438
   EPiServer.Web.Routing.DefaultUrlResolver.GetVirtualPathInternal(ContentReference contentLink, String language, VirtualPathArguments arguments) +894
   EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetVirtualPathInternal(ContentReference contentLink, String language, VirtualPathArguments arguments) +323
   EPiServer.Web.Routing.UrlResolver.GetUrl(ContentReference contentLink, String language, VirtualPathArguments virtualPathArguments) +14
   EPiServer.Cms.Shell.IContentExtensions.PublicUrl(IContent content, String language, RouteValueDictionary routeValues, UrlResolver urlResolver) +126
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.ContentDataModelBaseTransform.TransformInstance(IContent source, ContentDataStoreModelBase target, IModelTransformContext context) +587
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.d__0.MoveNext() +359
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.d__0.MoveNext() +432
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.d__0.MoveNext() +432
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.d__0.MoveNext() +432
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.d__0.MoveNext() +432
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +524
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +70
   EPiServer.Commerce.Shell.Rest.CatalogContentModelTransform.Execute(IEnumerable`1 models) +191
   EPiServer.Cms.Shell.UI.Rest.ContentStoreModelCreator.CreateContentDataStoreModels(IEnumerable`1 content, DefaultQueryParameters queryParameters) +440
   EPiServer.Cms.Shell.UI.Rest.ContentStructureStore.Get(ContentReference id, String query, ContentReference referenceId, String[] typeIdentifiers, Nullable`1 allLanguages, IEnumerable`1 sortColumns, ItemRange range) +429
   lambda_method(Closure , ControllerBase , Object[] ) +437
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +229
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
   System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +71
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3d() +72
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +386
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +386
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass2b.b__1c() +38
   System.Web.Mvc.Async.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult) +186
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +60
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137

What else could be wrong?

What more details are needed to figure this out?

#143545
Jan 26, 2016 16:39
Vote:
 

exception:

[NullReferenceException: Object reference not set to an instance of an object.]
   Mediachase.MetaDataPlus.MetaObject.CreateFieldStorage(MetaClass metaClass, Func`2 getValue) +207
   Mediachase.MetaDataPlus.MetaObject..ctor(MetaClass metaClass, Int32 objectId) +29
   Mediachase.Commerce.Catalog.Dto.CatalogNodeRowExtensions.StartDate(CatalogNodeRow catalogNodeRow, MetaDataContext context) +159
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.AddStaticAttributePropertyValues(CatalogNodeRow nodeRow, NodeContent content) +234
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.LoadStaticContentProperties(CatalogNodeRow nodeRow, CatalogItemSeoRow seoRow, NodeContent content) +144
   EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.LoadProperties(CatalogNodeRow nodeRow, CatalogItemSeoRow seoRow, NodeContent content, MetaObjectAccessor metaObjectAccessor) +176
   EPiServer.Commerce.Catalog.Provider.Construction.NodeBuilder.Create(IList`1 contentLinks, String language) +1130
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc) +774
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language) +606
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader) +234
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector) +624
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContent(ContentReference contentLink, ILanguageSelector languageSelector) +197
   EPiServer.Core.<>c__DisplayClass174_0.<LoadContentFromCacheOrRepository>b__0() +131
   EPiServer.Core.OptimisticCache`1.Read(String cacheKey, ReadAndCacheObject`1 readAndCacheObject) +811
   EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository(ContentReference contentreference, ILanguageSelector selector) +702
   EPiServer.Core.ProviderPipelineImplementation.GetItem(ContentProvider provider, ContentReference contentLink, LoaderOptions loaderOptions) +332
   EPiServer.Core.DefaultContentLoader.TryGet(ContentReference contentLink, LoaderOptions loaderOptions, T& content) +577
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.TryGetVirtualPath(HttpContextBase context, CatalogContentBase content, String language, String& virtualPath) +520
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.GetPartialVirtualPath(CatalogContentBase content, String language, RouteValueDictionary routeValues, RequestContext requestContext) +446
   EPiServer.Web.Routing.Segments.PartialSegment.GetVirtualPathSegment(RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues) +334
   EPiServer.Web.Routing.ContentRoute.AddVirtualPathFromSegments(StringBuilder virtualPath, RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues, Int32 lastNonDefaultIndex) +111
   EPiServer.Web.Routing.ContentRoute.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) +543
   EPiServer.Web.Routing.DefaultUrlResolver.GetUrlFromRoute(ContentReference contentReference, String language, RouteValueDictionary routeValues, RequestContext requestContext) +438
   EPiServer.Web.Routing.DefaultUrlResolver.GetVirtualPathInternal(ContentReference contentLink, String language, VirtualPathArguments arguments) +894
   EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetVirtualPathInternal(ContentReference contentLink, String language, VirtualPathArguments arguments) +323
   EPiServer.Web.Routing.UrlResolver.GetUrl(ContentReference contentLink, String language, VirtualPathArguments virtualPathArguments) +14
   EPiServer.Cms.Shell.IContentExtensions.PublicUrl(IContent content, String language, RouteValueDictionary routeValues, UrlResolver urlResolver) +126
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.ContentDataModelBaseTransform.TransformInstance(IContent source, ContentDataStoreModelBase target, IModelTransformContext context) +587
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.<Execute>d__0.MoveNext() +359
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.<Execute>d__0.MoveNext() +432
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.<Execute>d__0.MoveNext() +432
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.<Execute>d__0.MoveNext() +432
   EPiServer.Cms.Shell.UI.Rest.Models.Transforms.<Execute>d__0.MoveNext() +432
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +524
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +70
   EPiServer.Commerce.Shell.Rest.CatalogContentModelTransform.Execute(IEnumerable`1 models) +191
   EPiServer.Cms.Shell.UI.Rest.ContentStoreModelCreator.CreateContentDataStoreModels(IEnumerable`1 content, DefaultQueryParameters queryParameters) +440
   EPiServer.Cms.Shell.UI.Rest.ContentStructureStore.Get(ContentReference id, String query, ContentReference referenceId, String[] typeIdentifiers, Nullable`1 allLanguages, IEnumerable`1 sortColumns, ItemRange range) +429
   lambda_method(Closure , ControllerBase , Object[] ) +437
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +229
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +71
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +38
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +60
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
#143547
Edited, Jan 26, 2016 16:42
Vote:
 

XHR request url is:

http://site/cms/cms/Stores/contentstructure/?referenceId=1073742019_39_CatalogContent&query=getchildren&market=ALL&includeProperties=true&allLanguages=true&toplevel=true&currentCategory=1073742019_39_CatalogContent&simplified=false&sort(+typeSortIndex)&dojo.preventCache=1453821702535

#143552
Jan 26, 2016 16:53
Vote:
 

It looks like there is something missing in the node that you were viewing. Probably it could find the node's MetaClass Id. You might want to check the CatalogNode and MetaClass tables.

#143629
Jan 28, 2016 8:16
Vote:
 

You can check and show us procedure [ecfVersion_ListByWorkIds] in ECF database

#143698
Jan 29, 2016 8:07
Vote:
 
<p>I have figured it out!</p> <p>Just before failing following is called:</p> <pre class="brush:sql;auto-links:false;toolbar:false" contenteditable="false">exec mdpsp_sys_LoadMetaClassById @MetaClassId=32</pre> <p><br />it returns empty result as that metaclass does not exist anymore(for 4 years now) in MetaClass table</p> <p>So then when method StartDate is called:</p> <pre class="brush:csharp;auto-links:false;toolbar:false" contenteditable="false">private static DateTime StartDate(this CatalogNodeDto.CatalogNodeRow catalogNodeRow, MetaDataContext context) { if (catalogNodeRow == null) { return DateTime.MinValue; } MetaObject obj2 = MetaObject.Load(context, catalogNodeRow.CatalogNodeId, catalogNodeRow.MetaClassId) ?? new MetaObject(MetaClass.Load(context, catalogNodeRow.MetaClassId), catalogNodeRow.CatalogNodeId); DateTime? nullable = null; if (obj2 != null) { DateTime? nullable2 = nullable = (DateTime?) obj2["Epi_StartPublish"]; if (nullable2.HasValue) { return nullable.Value; } } return catalogNodeRow.StartDate; }</pre> <p><br />it tries to load:</p> <pre class="brush:csharp;auto-links:false;toolbar:false" contenteditable="false">MetaClass.Load(context, catalogNodeRow.MetaClassId)</pre> <p><br />witch returns null, becasue obviously metaclass with id 32 is not present in database</p> <p>then it tries to new up MetaObject and that null is passed in and everything fails</p> <p>checked my database by running query:</p> <pre class="brush:sql;auto-links:false;toolbar:false" contenteditable="false">SELECT MetaClassId, count(*) FROM [dbo].[CatalogNode] GROUP BY MetaClassId</pre> <p>result:</p> <pre class="brush:plain;auto-links:false;toolbar:false" contenteditable="false">MetaClassId (No column name) 32 1 33 1037</pre> <p><br />that one catalog node with id 32 is from 2012, and is old test category that was forgotten -&gt; so i deleted it</p> <p><br />Afterwards it works without errors!</p> <p><br />Weird thing is it was in diferent catalog than I was looking at, so i think it should not have affected other catalogs(however i have products underneeth there that are in other clalogs/catalog nodes as well),&nbsp;it is hard to say if it would have been better that commerce just eats that one category and shows everything else than nothing, but still:</p> <p>To repeat this, go to your CatalogNode table change one of the rows MetaClassId to non existant metaclass and commerce catalog browser will have problems</p>
#143702
Jan 29, 2016 8:45
Vote:
 
<p>Previous message is final answer, however it cant be marked as an answer for some reason</p>
#143707
Jan 29, 2016 8:57
Vote:
 

When i try to mark it as an answer or edit previous message this nice response from world.episerver.com is returned:

server says: 500 Internal Server Error

#143708
Jan 29, 2016 9:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.