Error, when trying to get images from custom module
I am trying to create a list of images that have been attached to my custom module.
But getting an error.
Object reference not set to an instance of an object. (attached)
I am using the following code to do it:
model.SelectedEvent = dynamicModuleManager.GetDataItems(wDREventType).Where(i => i.Id == eventId).Where(s => s.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).FirstOrDefault();
LibrariesManager libraryManager = LibrariesManager.GetManager();
var imageLinks = (ContentLink[])model.SelectedEvent.GetValue("Images");
foreach (var imageLink in imageLinks)
var image = libraryManager.GetImage(imageLink.ChildItemId);
//add new item to list
model.SelectedImageCollection.Add(image);
return View("Default", model);
Hello Andrew,
The described behavior is indeed strange, as we discussed in the support ticket you had open on the same topic, stepping through the code might help us get a better idea of the cause for this problem, or if you could provide us with the complete stack trace that would also be helpful.
Would it be possible, as a means for the faster resolution of this issue, to send us a sample project where the problem reproduces, so we can tests it locally and give you a more specific advice, or verify whether this is not an issue on our side that needs to be addressed?
Thank you in advance.
All the best,
Boyan Barnev
the Telerik team