Tag Archives: Sitecore

Sitecore – Could not load file or assembly System.Data.SQLite

After installing Sitecore v6, you get the following error when viewing the website or sitecore UI:

Sitecore Could not load file or assembly ‘System.Data.SQLite, Version=1.0.48.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

This is actually detailed in page 20 of the sitecore troubleshooting doc, but I missed it first time round. This is caused by the presence of System.Data.SqlLite in the bin folder when running on 64-bit OS. An alternative dll is available for 64bit OS from Sitecore.

Solution: If you’re are not using SQLite simply the delete the System.Data.SqlLite.dll from the bin folder and recycle your app to get back up and running. If you are using SQLite, download the alternative dll for 64bit OS.

Sitecore ContextItem.Database.SelectItems() and languages.

While poking around in the shared source RSS module for Sitecore, I found that several aspects of the “static feeds” feature loose language context during publishing. This only effects static feeds whereby the rss.xml file(s) are written to disk and linked-too directly. The processes is kicked-off my hooking into the publishing-end event.

While the similar method Context.Database.GetItem retrieves an item in the same language as the context item, it appears that SelectItems(selector, predicate) does not. So if you are in a language other than ‘en’ English, you will probably retrieve the ‘en’ version of your non-‘en’ language items, resulting in large areas of missing data.

I’m not sure if this only effects SelectItems()  when run outside of the context of a web request, or if it happens all the time, but the work-around is to explicitly change your context.language before calling SelectItems().

ContextItem.Database.SelectItems(selector, predicate);     …..will return ‘en’ language items regardless.

Instead you must use:

Sitecore.Globalization.Language.Current = ContextItem.Language;
ContextItem.Database.SelectItems(selector, predicate);    

….which then retrieves items in the same language of contextItem.