I had the same issue. This is what I was able to find out:
- This functionality depends on 5 properties in web property bag:
If they are missing, whole thing will not work. But, even if you additionally put them there (directly or be reactivating Ratings feature) it will not help you, because whole process of generating "stars" functionality is depending on one static class (Microsoft.SharePoint.WebPartPages.BaseDdwRuntime.RatingsDataManager) and guess what? These values are taken from the property bag during initialization of this class so you need either to recycle whole web application (tried, it works) or somehow dispose living instance of the whole web and let SP to create it anew after response (never tried, might work too).
- Our problem was that we needed this to start working right after site is provisioned. Our solution has this "on demand sites creation" process; so something like "let's recycle web app pool each 10 minutes" (handled by windows task which was running provisioning script) was not acceptable. We didn't wanted to go force dispose either (probably disposing instance of the SPWeb where it is highly not recommended, e.g. from SPContext).
Other question was why it is not working. Ratings feature has been activated each time successfully -> reflector. I found this:
public override void FeatureActivated(SPFeatureReceiverProperties properties)
SPSite sPSite = (SPSite)properties.Feature.Parent;
SPWeb rootWeb = sPSite.RootWeb;
bool allowUnsafeUpdates = rootWeb.AllowUnsafeUpdates;
rootWeb.AllowUnsafeUpdates = true;
rootWeb.Properties["Ratings_ImageStripUrl"] = "/_layouts/Images/Ratings.png";
rootWeb.Properties["Ratings_ImageStripRtlUrl"] = "/_layouts/Images/Ratingsrtl.png";
rootWeb.Properties["Ratings_EmptyIconUrl"] = "/_layouts/Images/RatingsEmpty.png";
rootWeb.Properties["Ratings_NewRatingIconUrl"] = "/_layouts/Images/RatingsNew.png";
rootWeb.Properties["Ratings_FeatureActivated"] = "true";
rootWeb.AllowUnsafeUpdates = allowUnsafeUpdates;
I was like WTF? What a great idea, put something into the try-finally block! Love you MS :(
So no chance of finding out what happened there. No exception, no logging. My only guess is that it failed when code was calling Update method. It will be nothing new for us in our project; exception like "object is already used by another user/thread" or something like that.
Our solution was simple: during our provisioning process we put activation of the Ratings feature and related features after the whole process has been finished at the very end.
I hope this brought some insight to the problem.