I had a compile time error for Telerik.Mvc dll about ambiguous reference match in admin area and I un-referenced the Telerik.Mvc dll and re-referenced it and the compile time error was resolved.
But now when I try to access the admin I get the following runtime error:
Object reference not set to an instance of an object.
Html.Telerik().Menu().Name("Admin")
.BindTo("admin", (item, siteMapNode) =>
{
if (!String.IsNullOrWhiteSpace(item.ControllerName))
{
//apply admin area as described here - https://www.nopcommerce.com/boards/t/20478/broken-menus-in-admin-area-whilst-trying-to-make-a-plugin-admin-page.aspx
item.RouteValues = new RouteValueDictionary()
{
{ "area", "Admin" }
};
}
var imageUrl = siteMapNode.Attributes["ImageUrl"];
if (imageUrl != null && !string.IsNullOrEmpty(imageUrl.ToString()))
{
item.ImageUrl = imageUrl.ToString();
}
var resourceName = siteMapNode.Attributes["nopResource"];
if (resourceName != null && !string.IsNullOrEmpty(resourceName.ToString()))
{
item.Text = T(resourceName.ToString()).ToHtmlString();
}
if (ViewBag.SelectedMenuItem == item.Text)
{
item.Selected = true;
}
if (hideAdminMenuItemsBasedOnPermissions)
{
var permissionNames = siteMapNode.Attributes["PermissionNames"];
if (permissionNames != null && !string.IsNullOrEmpty(permissionNames.ToString()))
{
item.Visible = permissionNames.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Any(permissionName => permissionService.Authorize(permissionName.Trim()));
}
}
})
.Items(x =>
{
if (adminMenuPlugins.Count() > 0)
{
if (!hideAdminMenuItemsBasedOnPermissions ||
permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
{
x.Add().Text(T("Admin.Plugins").ToHtmlString()).Items(y =>
{
foreach (var adminMenuPlugin in adminMenuPlugins)
{
adminMenuPlugin.BuildMenuItem(y.Add());
}
});
}
}
})
.OpenOnClick(false)
.Render();
Source File: d:\Skydrive\Projects\Technomobiles\Technomobiles_source\Presentation\Nop.Web\Administration\Views\Shared\Menu.cshtml
Full stacktrace: https://gist.github.com/mumair85/204903ffd326c631a3a5
So I tried to put this in try catch and admin area works fine, but the menu is not generated due to the above error. Can anyone help, or did anyone had this issue before?
Any idea how to resolve this issue?