Sean Holmesby

.NET and Sitecore Developer


Serialization Exception in the Sitecore 8 Experience Explorer

I recently received a serialization exception when attempting trigger a Campaign within the new Experience Explorer feature in Sitecore 8, using the LaunchSitecore demo site.

Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''.

[SerializationException: Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''. ]
ReadArrayOfKeyValueOfstringstringFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString , CollectionDataContract ) +885
System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) +154
System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) +61
System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract) +210
System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns) +69
System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName) +177
System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) +628
System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader) +73
Sitecore.Common.Serializer.Deserialize(String data, Type resultType) +541
Sitecore.Common.Serializer.Deserialize(String data) +89
Sitecore.SecurityModel.UserRuntimeSettings.DeserializeInnerDictionary(UserRuntimeSettings data, String dictionaryKey) +259
Sitecore.SecurityModel.UserRuntimeSettings.Deserialize(String data) +198
Sitecore.Security.Accounts.User.get_RuntimeSettings() +333

I also found the same issue when running my LaunchSitecoreTDS code base on a fresh instance…

Debugging this was difficult, as no exceptions were popping up in Visual Studio, and nothing useful was being written to the logs other that this exception.
Read More


Images not Resizing in Sitecore 7.5, Sitecore 8.0

Sitecore 7.5 brings some changes to the way images are resized on the server, and it may mean that you’ll find some images on your site aren’t being resized after upgrading. These changes are intentional, and provide better security for media requests, but depending on your past implementations…you may see this issue on your site.

Sitecore has always been able to resize images on the server by passing parameters to the image rendering controls, <sc:image> and <sc:FieldRenderer>.

In the past, the resulting image URL of this was the normal image path with a query string appended showing the parameters.
i.e http://mywebsite/~/media/System/Simulator Backgrounds/Android Phone.ashx?w=50

01 - Motorolla Full(trimmed for display here)

Shinks down to this….

02 - Motorolla Small(resized)

From Sitecore 7.5 onwards, if you attempt to load an image URL directly (by just appending a query string like the one above), the image will not be resized, and the full image will be shown.

Read More


Presentation Details Changes in Sitecore 8 – How Renderings are Stored with Versioned Layouts

Sitecore 8 has changed the way renderings on a page are stored on an item. A page’s full presentation can now be updated (hopefully through the Experience Editor) for an individual version…meaning those changes can go through workflow to be approved. It also means layout changes can be rolled back to previous versions easily.

Note: Screenshots and investigation for this post has been done using the Sitecore 8 Technical Preview handed to Sitecore MVPs. The final result may change for the initial release of Sitecore 8.

Read More


CopySauce, a file Copying Utility for Sitecore Development

A while ago a good friend of mine, Dave Nicolson, created a utility that assists front-end developers with Sitecore development. The tool watches changes to front-end files in your Source directory, and copies them over to your Website directory….saving the need for a full Visual Studio build, and thus, no App Pool recycle.

Download CopySauce here.

Note: Basic documentation is included in the download.

CopySauce was branded by Igloo (now Authentic Entertainment), and my original post of the utility can be found here.

Read More


Fixing Visual Studio IntelliSense in Sitecore MVC Views

IntelliSense in Visual Studio is a fantastic auto-complete feature that greatly improves your Sitecore development, however I’ve occasionally seen this not working in my MVC solutions.

01 - HTML Sitecore Helper not working

In particular, I was seeing the following error highlighted around any calls to the @Html.Sitecore() helper:-

‘System.Web.Mvc.HtmlHelper<Model>’ does not contain a definition for ‘Sitecore’ and no extension method ‘Sitecore’ accepting first argument of type ‘System.Web.Mvc.HtmlHelper<Model> could be found.’

This would mean that I could not get auto-complete on the @Html.Sitecore() helper, nor would I get auto-complete for my properties on my Glass Models.

Read More


Multiple Datasource Locations using Queries are back in Sitecore 7.2 Update-2

Sitecore 7.2 Update-2 (rev.140526) was recently released, and one of the entries in the Release Notes was this:-

  • Layouts and renderings
    • The Select the Associated Content dialog did not handle multiple data sources correctly. It only used the first data source and ignored any additional data sources. This has been fixed. (389483)

A while back Thomas Stern wrote a post detailing a way to allow for queries in Datasource locations, so that the Associated Content dialog could be more flexible for multi-site solutions.

I tested out his solution back when the post was written, and it worked perfectly. However I found that it was broken in both Sitecore 7.0 and 7.1.

Read More


A fix for the Sitecore 7.1 Upgrade Process

This is a fix for the Sitecore 7.1 upgrade process, where Rules fields may not have their Source (Rules Context) updated correctly during the upgrade. The fix was originally posted on my Github repo and should be used when upgrading from Sitecore 7.0 to Sitecore 7.1.
It has been assessed and approved by Sitecore Support.

How to Fix the normal process

Follow the initial steps (Steps 1 to 9) in the Sitecore update installation instructions here.
Before installing the Sitecore 7.1 update package in the Update Installation Wizard (Step 10,11):-

  • copy the Hedgehog.SC71Upgrade.DLL file from the __install files directory into your Website’s /bin directory.
  • make a change to the App_Config/FieldTypes.config file with the following change.
    • change
      <fieldType name="Rules" type="Sitecore.Data.Fields.TextField,Sitecore.Kernel" resizable="true" />
      <fieldType name="Rules" type="Hedgehog.SC71Upgrade.Data.Fields.RulesField,Hedgehog.SC71Upgrade" resizable="true" />
    • Note: This change can be seen in the example file located here __install files/FieldTypes.config.
  • Now install the normal update package (Step 10,11 in the Sitecore update installation instructions) and complete the remaining steps for the upgrade.

Read More


How to fix missing Conditions and Actions in Rules fields in Sitecore 7.1

Update: I found a bug in the Sitecore 7.1 Upgrade Process that causes the issue mentioned in this post. An explanation and a fix for the process can be found at my Github repository,

I previously posted about the Sitecore Upgrade ‘Post Step’ code that gets executed on items when upgrading Sitecore to a newer version. The Post Step code in the Sitecore 7.1 upgrade processes the Conditions and Actions items for Rules fields…meaning your existing Rules fields may be affected during the upgrade process.

When Sitecore 7.1 was released Adam Conn wrote a blog post about the changes to how Rules work in the new update. With everything shifted around in the content tree, I knew there would be some sort of Post Step to update existing Rules items.

My LaunchSitecoreTDS repo (taken from the Launch Sitecore demo site) has a custom action that automates the enrollment of a user in an engagement plan, so with the package originally being built for Sitecore 7.0, something was going to happen with the items when upgrading to Sitecore 7.1.

The ‘Enroll in Automation State’ item had moved from:-


The action was originally setup to be executed on the Register Goal in the Marketing Center.
But now Rules fields respond to their ‘Rules Context’ (their Source on the field), allowing developers to limit what conditions and actions are available for a given rules field….
So now our custom action cannot be added to any other similar Page Events we setup, because it isn’t set as the Source for any field. Read More


Sitecore Upgrade Post Step Scripts

Charlie Turano recently told me a lesser known fact about Sitecore’s upgrade process. There is a block of code that gets executed to update existing items in the database. This is what’s known as an installation ‘Post Step’, and it gets triggered after the new or changed items are added to the database.

For example, Sitecore 6.5 updated the ‘Placeholder Settings’ items to have a new ‘Placeholder Key’ field.
01 - Placeholder settings extra field Read More


DataFolder config patch for Sitecore Instance Manager (SIM) installs

The Sitecore Instance Manager (SIM) tool is a fantastic tool for quickly setting up local Sitecore installations. I love using it for quick setup when sandbox testing features, or new shared source modules from the community.
It’s so simple that you just click on the ‘Install Instance’ button, fill out the information for the site you want, and off it goes, extracting the webroot, attaching databases, setting up IIS and everything. It’s great!

01 - SIM Install

One thing I found when setting up my sites was that the Data folder was saved within the actual Web.Config, as opposed to it being patched in with an App_Config/Include file.

Read More