After uploading a new skin I developed onto a DNN 6.1.4 installation, the Host/Extensions page did not display the list of installed modules, skins, etc. anymore, but only showed the error message
Object reference not set to an instance of an object.
The current log file under \Portals\_default\Logs contained the complete stacktrace:
[date:time] [server][Thread:14][FATAL] DotNetNuke.Framework.PageBase - An error has occurred while loading page. System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Services.Installer.Packages.PackageController.CanDeletePackage(PackageInfo package, PortalSettings portalSettings) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.extensionsGrid_ItemDataBound(Object sender, DataGridItemEventArgs e) at System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) at System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.BindGrid(String packageType, DataGrid grid, Label noResultsLabel) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.extensionTypeRepeater_ItemDataBound(Object sender, RepeaterItemEventArgs e) at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.BindPackageTypes() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [date:time] [server][Thread:14][ERROR] System.Web.UI.Page - ~/Default.aspx?tabid=36&error=Object+reference+not+set+to+an+instance+of+an+object.&content=0 System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Services.Installer.Packages.PackageController.CanDeletePackage(PackageInfo package, PortalSettings portalSettings) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.extensionsGrid_ItemDataBound(Object sender, DataGridItemEventArgs e) at System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) at System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.BindGrid(String packageType, DataGrid grid, Label noResultsLabel) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.extensionTypeRepeater_ItemDataBound(Object sender, RepeaterItemEventArgs e) at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) at DotNetNuke.Modules.Admin.Extensions.InstalledExtensions.BindPackageTypes() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The DNN forums contain bug reports for this error message since at least 2008 (!), but most often the entries contain no solution on how to proceed. Or at least, on how to find the offending module, skin, control, whatever that causes the CanDeletePackage() function to fail.
You’d expect that during the last 4 years, somebody would have bothered to at least log the item that’s causing the error, or fix CanDeletePackage() to handle a NULL parameter. But no.
The only useful hint I found was on this self-answered question,
2 rows in the packages table were invalid- they were pointing at packages that no longer existed. I think maybe i renamed or deleted these skins on the file system- guess i should not do that
So I had a look at the Packages table in the DNN database, and indeed it contained a record for a skin container that I did not declare. Probably that was caused by an empty
<components></components>
section in the .dnn file? I have no idea.
I deleted the record, and was able to load the Host/Extensions page again. I uploaded and updated the previously installed skin package, and things still worked. The erroneous record did not show up again.