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)
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)
  • You mention it stopped working after applying a couple of hotfixes, I suggest you try to undo them and see if that indeed fixes the situation, then you can see which one of the specific hotfixes (or perhaps a combination of them) is responsible for it. With that information you need to get back to Custom Support as there is nothing we can do here to fix things which are actually broken. Commented Jun 4, 2018 at 9:25
  • Hello Bart, Thanks for suggestion, Actually we have migrated from 2011 to web 8 last year and at that time our custom .net code was working fine and our pages showed Component Metadata. As you said, we have tried reverting ContentDelivery Dll and OData dll to several diferent versions which we found in last 1 year but nothing worked in our case. Also in the logs, we are getting the metadata details from broker Db but somehow that Content Delivery DLL is not returning that metadata to our .net code. SDL Support case already raised and we are also working with them to find out the root cause. Commented Jun 5, 2018 at 4:58
  • Can you please edit your question and supply this additional information in there so you can properly format it? Commented Jun 5, 2018 at 6:51

1 Answer 1


MemberAccessException is thrown by the following methods:

Invoke of the System.Reflection classes, GetValue of the FieldInfo class, and DynamicInvoke of the Delegate class.

Apps compiled by using the .NET Native tool chain may throw a exception at runtime. is an internal-only exception type derived from MemberAccessException. The exception indicates that metadata needed for the successful execution of an app is not present at runtime. You should not use a try/catch block to handle the exception. Instead, you should determine what metadata is missing and modify your app's to ensure that it is present at runtime.

MemberAccessException uses the HRESULT COR_E_MEMBERACCESS, that has the value 0x8013151A.

For a list of initial property values for an instance of MemberAccessException, see the MemberAccessException constructors.

Regards Abhijit Angre

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.