Tuesday, March 20, 2018

System.Collections.Concurrent.ConcurrentBag Has a hissy fit.


It's well acknowledged that installing Sitecore Commerce 8.2.1 can be beastly to install and more so in a scaled environment. I have done many times now, I was beginning to find it straightforward... let your guard down for a moment and BOOM! Microsoft come a'callin. 

All credit to Tan Vu from Sitecore support, he's great ! - I'm just the documenter. 

Unable to cast object of type 'System.Collections.Concurrent.ConcurrentBag`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]' to type 'System.Collections.Generic.IReadOnlyCollection`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Collections.Concurrent.ConcurrentBag`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]' to type 'System.Collections.Generic.IReadOnlyCollection`1[Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration]'.

 


This is what might have happened to you:
  • .NET framework 4.5.2 contains System.Collections.Concurrent.ConcurrentBag<T> class from System.dll which implement IReadOnlyCollection<T> interface, but due to the some security updates from Microsoft side, ConcurrentBag<T> was changed, and as a result, it does not implement IReadOnlyCollection<T>. In order to check whether one of the aforementioned security updates was installed on your server, you can review the version of C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll 
    For the regular .NET framework 4.5.2 this version looks like 4.5.2... , but if security update was installed it will look like 4.0.30319.36388 (It seems to me that these security updates were built based on .NET framework 4.0 which did not have IReadOnlyCollection<T> interface at all.
  • In this way, if the server has .NET framework 4.5.2 without aforementioned security updates, provided by Microsoft, then System.dll will have System.Collections.Concurrent.ConcurrentBag<T> which implement IReadOnlyCollection<T> interface, in contrast to .NET framework 4.5.2 with security update. This error may happen because of these security updates.
Thus, to fix this problem, please update the .NET framework version on your server to at least 4.6.1
Then, please update the following configuration on your Web.config file:

  • <compilation defaultLanguage="c#" debug="false" targetFramework="4.6.1">
  • <httpRuntime targetFramework="4.6.1" ..

Thanks again Vu Tan!

Hope this helps someone out there who doesn't have a Vu Tan to lean on :-) 










Sunday, March 4, 2018

Hackathon 2018 in New Zealand



Azure 

As a pseudo developer (with impostor syndrome 50% of the time) I am over it! - By that I mean configuration -  hours of of messing around in config files, searching, replacing (seriously guys JSON is for machines), SIF and SIFLess are fun, but I think all this is headed for automation.

It doesn't mean developers will disappear, (though sometimes the marketing department wishes they would) but I believe we will become accustomed to telling a machine how to do our job a lot more than we do now. 

With all that in mind, I spun up a quick instance of Sitecore on an Azure portal, everything just worked and it took 52 minutes. I'm completely sold on how easy it was and hope to never do it any other way. 



Just to balance that, here's the costs for a day and a half with minimal usage.

The Poutineers 

Sitecore List & Contact Knowledge Share - Slacks


Kiwis and Canadians have a natural affinity I feel, so it was a delight to be considered by Chris Williams. My fellow Marmite Muncher Ryan Bailey was also onboard. 

Now I have to say, our concept is a good one, really good. Privacy advocates might shrink back while marketing types shriek with delight, but I love the idea of preemptively building anonymous Contacts from likely channels using machine learning to sift for targeted profiles.  

One could then do some cool strategies to identify and connect these Contacts and bingo! Instant in-depth profile!!



It's a big idea and Chris was sensible to contain it to a simple demo where we displayed a list of articles based on the keywords and IDs extracted from a single slack channel.  

Even so were still firing stuff up minutes before the cut-off and it's pretty raw, but exciting.

The real fun bit will be wiring up the ML and pulling in cognitive services. Want to know how my site knows you like kittens? Well you sure have posted a lot of pictures of them all over the net :-)  This would work even better with identified contacts, rainbow unicorn dragon kittens.

Thank you Chris and Ryan you letting me participate, a very cool idea came out it so I feel like we've already won.
I also learnt Surface Books can overheat doing video rendering,  mmm toasty.