The Sitecore 8.1 and Windows 10 Conundrum

A while back when working on a Sitecore 8.1 solution, our team encountered this bug when hitting certain pages with URL's containing dashes on the site:

Sitecore 8 meets Windows 10

After talking to my co-workers (Alan Coates and Thomas Stern) it turned out that this was already an known issue, and that a support case had been made. Sitecore have made a fix (you can also check out the Sitecore support issue: 448443) and registered it as a bug, since the problem only occurs if you have a url where there is a dash in the first part of it.

Next I tried to apply the Sitecore support hotfix, only to be presented with a new error. The error stated that the specified language was not a valid, so I decided to decompile their hotfix to see what was going on under the hood. Going over their code, I found a method where they check whether the specified language name is a valid culture info:

A closer look on the Sitecore Support hotfix

However, there is a problem here (marked with red) as the code assumes that the culture always is valid - and based on the way our URL looked (containing various dashes), the languageName parameter was not supplying a valid culture. A quick fix to this is to ensure that the cultures are being parsed instead:

.csproj cracked open

If you look at the code for the entire hotfix you'll find that this way of parsing the culture is actually done a few lines further down in a general method that calls the IsValidCultureInfo method, which makes me wonder why the parsing was not done in the IsValidCultureInfo method as well.

Patching in the new code changes to the hotfix, our solution was up and running, without any problems on Windows 10 as well as Windows 8.1. I should add that the solution was using the initial version of Sitecore 8.1, and not the update 1 patch. However, looking at the release notes, this doesn't seem to be something the folks at Sitecore have addressed in the update 1 patch.

If you are using Sitecore 8.1 update 1 patch, I'd love to hear back from you in the comments section below. Are you experiencing the Windows 10 issue, or can you verify that it has been fixed once and for all?