I am getting null
when reading Component metadata. Below is the source code where I am passing Component TCM ID as a parameter.
Though it was working fine until a few months ago, we have deployed couple of hotfixes provided by SDL and then it stopped working. Also in the logs, the metadata from Broker DB is showing correctly.
Only from my custom code, from where I am calling below line of code, I am getting null
. Please help.
ComponentMetaFactory metaFactory = new ComponentMetaFactory(publicationId);
IComponentMeta componentMeta = metaFactory.GetMeta(tcmsResults[i]);
Category[] categories = componentMeta.GetCategories(); //line no 3
Here in line 3, I am getting object reference error because componentMeta
returned is null
.
One additional information is, after checking in debug diagnostic tool, we got below exeption.
Type: System.MemberAccessException
Message: Type initializer was not callable.
Stack: [HelperMethodFrame]
System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
System.Reflection.ConstructorInfo.Invoke(System.Object[])
Sdl.Web.Delivery.Core.ObjectDeserializer.Deserialize(System.Object, System.Type)
Sdl.Web.Delivery.Core.ObjectDeserializer.Deserialize[[System.__Canon, mscorlib]](System.Object)
Sdl.Web.Delivery.Dynamic.Meta.AbstractMetaFactory+<>c__DisplayClass5`1[[System.__Canon, mscorlib]].<ExecuteFunc>b__2()
Sdl.Web.Delivery.Service.DummyCacheProvider.AddOrGetExisting(System.String, System.Func`1<System.Object>, Boolean)
Sdl.Web.Delivery.Dynamic.Meta.AbstractMetaFactory.ExecuteFunc[[System.__Canon, mscorlib]](Sdl.Web.Delivery.Service.ODataV4ClientFunction, Boolean)
Sdl.Web.Delivery.Dynamic.Meta.ComponentMetaFactory.GetMeta(System.String)
Tridion.ContentDelivery.Meta.ComponentMetaFactory.GetMeta(System.String)