This project is read-only.

Themes Admin Page Exception

Jun 26, 2012 at 8:32 PM
Edited Jun 26, 2012 at 8:41 PM

I'm doing a BE 2.6 Multi-blog XML-to-SQL conversion and everything's working nicely.  I just noticed an exception when selecting Themes and can only conclude I missed something in the conversion.  I'm not getting the error with the BE 2.6 XML Provider.  I'm also wondering if this is common to SQL Provider installations, possibly something missing in the Install Script?  be_Settings perhaps?  I noticed the "israzortheme" setting property isn't entered in the v2.6 Setup script.  Haven't checked on other possible missing properties, or if it matters.

I'm using the Web Application source and as I said, the SQL Provider.  I'm getting an object reference exception in /admin/Extensions/Themes.cshtml on


Here's a screenshot.

Stepping through the .cshtml @Helper source doesn't help me much, unless I'm doing it wrong.

Thanks for any suggestions. 


Aug 1, 2012 at 11:34 PM

I finally made time to track this down.  The exception was caused by the fact that my theme was not listed in the BlogEngine.NET Gallery and thus PackageRepository.GetPackage() didn't return a valid JasonPackage resulting in a null @currTheme.

I coded a quick workaround in AdminHelper (retrieve packages for "Standard" and "Mobile" themes for current theme icon display if null), but this is telling me that any BlogEngine.NET theme a user wishes to use must be registered and retrieved from the BlogEngine.NET Gallery.  I understand that the point of going Razor is to support plug-n-play themes, extensions, etc., and it's very cool, but that seems a bit severe.  At the least, users should be able to create custom themes without having to put them in the Gallery.

Or am I missing something?



Aug 2, 2012 at 1:46 AM

If you have new theme with the same name as in gallery, this conflicts and resolution is not very graceful - new theme would not show in the list at all. The easiest to simply rename folder(s) for local theme(s) so it is differ from existing in the gallery if this is your situation.

Aug 2, 2012 at 12:32 PM

The theme name is not in gallery (slushie).  

I think I just realized why I was seeing the exception.  In the XML-to-SQL Conversion work I was doing for v2.6 I set the theme in SQL and not in the UI on Admin Themes.  Had I gone to Admin Themes using the Standard theme I no doubt could have changed to my custom theme without incident.

Thanks for your thoughts, Rtur.  Something you said triggered my realization of the chain of events leading to the exception.