dotnetnuke - Dnn Remove Razor Host module from tab programmatically doesn't delete it properly -
i have razor script running in razor module, _bootstrapper.cshtml, responsible generating bunch of pages , adding modules them. when it's done there's button remove razor host module (_bootstrapper.cshtml) page.
the code follows:
public void removebootstrapper(int portalid, int pageid) { list<moduleinfo> listofmodules = getpagerazorhostmodules(portalid, pageid); foreach (moduleinfo module in listofmodules) { foreach (var settingkey in module.modulesettings.keys) { if (settingkey.tostring().tolower() == "scriptfile") { if (module.modulesettings[settingkey].tostring().tolower() == "_bootstrapper.cshtml") { deletemodulefrompage(pageid, module.moduleid, false); } } } } } public void deletemodulefrompage(int pageid, int moduleid, bool softdelete) { modulecontroller modulecontroller = new modulecontroller(); modulecontroller.deletetabmodule(pageid, moduleid, softdelete); }
a couple of notes:
- when call removebootstrapper executes without exception
- after calling removebootstrapper page reloads, razor host module still on page, nothing rendered, it's blank
- trying access properties on blank razor host module results in exceptions, e.g. settings,
- trying use module context menu remove module throws exceptions
here few exceptions i'm seeing logged:
- 2017-07-28 08:39:31,198 [win-dsk-2][thread:6][error] dotnetnuke.services.exceptions.exceptions - system.nullreferenceexception: object reference not set instance of object. @ dotnetnuke.modules.admin.modules.modulesettingspage.oninit(eventargs e)
- 2017-07-28 08:39:31,233 [win-dsk-2][thread:6][error] dotnetnuke.services.exceptions.exceptions - dotnetnuke.services.exceptions.moduleloadexception: niet afgehandelde fout bij toevoegen module aan contentpane ---> system.nullreferenceexception: object reference not set instance of object. @ dotnetnuke.modules.admin.modules.modulesettingspage.oninit(eventargs e)
- 2017-07-28 08:39:31,341 [win-dsk-2][thread:6][error] dotnetnuke.services.exceptions.exceptions - friendlymessage="fout: op dit moment niet beschikbaar." ctrl="asp.admin_modules_modulesettings_ascx" exc="system.nullreferenceexception: object reference not set instance of object. @ dotnetnuke.security.permissions.permissionprovider.candeletemodule(moduleinfo module)
- 2017-07-28 08:39:31,653 [win-dsk-2][thread:6][error] dotnetnuke.services.exceptions.exceptions - friendlymessage="er een fout opgetreden." ctrl="asp.admin_menus_moduleactions_moduleactions_ascx" exc="system.nullreferenceexception: object reference not set instance of object. @ dotnetnuke.ui.containers.actionbase.get_actionroot()
- 2017-07-28 08:39:31,662 [win-dsk-2][thread:6][fatal] dotnetnuke.framework.pagebase - error has occurred while loading page. system.nullreferenceexception: object reference not set instance of object. @ dotnetnuke.modules.admin.modules.modulesettingspage.oninit(eventargs e)
- 2017-07-28 08:39:31,668 [win-dsk-2][thread:6][error] dotnetnuke.services.exceptions.exceptions - ~/default.aspx?tabid=1819&error=object+reference+not+set+to+an+instance+of+an+object. system.nullreferenceexception: object reference not set instance of object. @ dotnetnuke.modules.admin.modules.modulesettingspage.oninit(eventargs e)
edit 1:
troubleshooting step revealed odd.
click remove, page reloads , shows blank razor host module causes problems. reset iis, refresh page , blank razor host module gone. tried number of times , it's consistent. i'm assuming might related in-memory cache then, why? i've never seen behavior before. page cache set 'not specified'.
edit 2:
can reproduce behavior in edit 1 clicking clear cache in dnn
Comments
Post a Comment