6

I am using the following code to site edit the component links(multi-allowed field).

@foreach(var comp in Fields.leader_list) {

    <tcdl:ComponentField name="Fields.leader_list" index="@comp.Index">
    ...
    </tcdl:ComponentField>

}

I am able to publish the page and the span tag in the source for the field is (seems to be correct) where leader_list is the field having the comp links:

<!-- Start Component Field: {"XPath" : "tcm:Content/custom:Content/custom:leader_list[1]"} -->

Now once I update the comp links and click "Update Preview", the components are getting updated in tridion but it's throwing the below error while publishing the component:

"Cannot perform runtime binding on null reference"

Please provide a direction.

1
  • 1
    That's a good one. Please take a look at the odata, application and CM Event Viewer logs and share that output. Commented Sep 27, 2013 at 15:32

2 Answers 2

3

I have experienced exactly the same problem and I figured that this error is caused by the Razor Mediator when trying to access an object which is null, for example, a component link field which does not contain a value. Yo might want to check your Razor Template Building Block for possible "null" values. Keep in mind that experience manager calls the templates for rendering.

In my case I was trying to access an "optional" field without checking whether it was empty or not, and when empty (Removed from Experience Manager), I got the infamous:

Cannot perform runtime binding on null reference

The steps I took to figure this out are: 1. Open the Page Template you are Using and run it against the page you are working on 2. Open each individual Component Templates the page renders and render them with the components you are using in such page.

This way you'll see what's the Template causing the issue, then, debug further (I use the @Debug("1") to write debug lines within the razor tbb).

Hope this helps.

1
  • I've seen this error also in C# templates, when trying to access an object that's null. Seems like a 'general' error message when an error occurs in your templates when XPM tries to render the updated preview. (running your templates in preview mode) Commented Mar 10, 2014 at 7:45
-1

This has started working now. Not sure what was the cause.

1
  • Were any services restarted? - perhaps overnight automatically? Commented Oct 1, 2013 at 17:02

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.