Tuesday, August 5, 2014

ParseDataSourceString moved between version 7.1 and 7.2 of Sitecore

If you have upgraded from Sitecore 7.1 to 7.2 or sharing code libraries between 7.1 and 7.2 you may start getting an error message like this:

Method not found:  'System.Collections.Generic.IEnumerable`1<Sitecore.ContentSearch.Utilities.SearchStringModel> Sitecore.ContentSearch.Utilities.SearchStringModel.ParseDatasourceString(System.String)'.

The reason is that the ParseDatasourceString method moved between Sitecore versions.

In 7.1 you would find it in: Sitecore.Buckets.Utils.UIFilterHelpers.ParseDatasourceString whereas in 7.2 it can be found in Sitecore.ContentSearch.Utilities.SearchStringModel.ParseDatasourceString

The solution is to have two versions of your dlls or wrap this call in a third dll you can call from your larger library.  If you have the namespace the same in both projects you can swap them out for each version.

If you have any questions, tips, tricks or resources please email me at chris.williams@readwatchcreate.com