Tag Archives: Sitecore

Disabling optimizations – debugging third-party dlls with Reflector Pro

Numerous times in recent years I’ve had to use Reflector Pro to debug third-party dlls. While this works well and allows you to step through code as if it was your own the value of doing so can be completely lost if you cannot see critical object values due them being ‘optimized away’.

Recently I was stuck with a problem of optimization that refused to be disabled by the usual means that I’d used in the past. I stumbled onto a neat trick which finally did work, but it also clarified what happens when the web application, usually Sitecore CMS, restarts.

Continue reading

Sitecore Mongo arbiter shows failed authentication attempts.

I setup a Mongo arbiter instance alongside two full instances for use with Sitecore 8 xDB database. Shortly afterwards I noticed the arbiter log was full of authentication failures. This isn’t a big huge problem, but it fills up the arbiter log and may cause concern wondering if there’s an underlying configuration problem.

Continue reading

Improve your sitecore log with realtime output and calling class

Sitecore uses the extensive log4net logging framework to handle the large volume of logging entries it generates. Sometimes vague log entries can leave you scratching around trying to find where they originated from. This post explores some simple steps to add useful detail to, and real-time viewing of, the Sitecore log.

Continue reading

Filtering search on folder path with Sitecore Contentsearch API

Using the new Sitecore contentsearch api allows you search against a lucene index with very little effort. Examples are a bit short on the ground but using Linq you can find yourself doing something like this to search for an item by name, somewhere within a folder structure:

public void BadSearch(string searchTerm)
   var webIndex = ContentSearchManager.GetIndex("sitecore_web_index");
   using (var context = webIndex.CreateSearchContext())
      var results = context.GetQueryable<SearchResultItem>().Where(i =>
         i.Name == searchTerm &&
         i.Path.StartsWith("sitecore/content/stuff/")); // don't do this!

This may well work. However you may also run into a Lucene error stating that you are using too many clauses, the default limit is 1024.

Continue reading

GridView problem – Item has already been added. Key in dictionary: ‘Timestamp’ Key being added: ‘Timestamp’

In general ASP.net, this can be caused by calling DataBind() more than once on a databound control. Also be aware that this is influenced by automatic databind being on too.

Relating this to Sitecore CMS, you should be aware that Sitecore ships with the following line in web.config:

Indicates if the data bind function is run automatically
setting name=AutomaticDataBind value=false />

This means that you will need to either call Databind whenever you need it, or you can simply set this value to true.  This AutomaticDataBind setting will also cause problems with other types of databound controls, such as templated controls. It’s generally simpler to set it to ‘true’..