Kentico 9 and the Windows 10 April 2018 Update

   —   

As with all combinations of software, sometimes updates increase or improve functionality and other times something that used to work before stops working after the update is finished. Because of an unforeseen addition to the Windows 10 April 2018 Update, typical installations of Kentico 9 have run into a breaking change. The good news is, there is an easy fix, so read on.

Included with the Windows 10 April 2018 Update (also known as Windows 10.0.17134 or version 1803) is .NET Framework 4.7.2. This .NET Framework version is also included in the following KB updates:

  • KB4073120, on Windows 10 Fall Creators Update
  • KB4054590, on Windows 10 Anniversary Update, Windows 10 Creators Update and Windows Server 2016
  • KB4054566, on Windows 8.1 or Windows Server 2012 R2
  • KB4054542, on Windows Server 2012

For more recent server editions of Windows 10, this Windows 10 version has not yet been released

Back in 2015, when Kentico 9 was released, the highest available .NET Framework version was 4.6, and Kentico 9 was tested for both versions 4.5 and 4.6. This means that after installing the Windows 10 update, Kentico 9 is running in an untested environment. In .NET Framework 4.7.2, Kentico 9 throws an error message with the following text:

CS1660: Cannot convert lambda expression to type  'System.Collections.Generic.IEqualityComparer<int>' because it is not a delegate type

The full error appears like this screenshot:

WindowsError.png

This error occurs in the ~\App_Code\CMS\UpgradeProcedure.cs file for a web site installation, or the ~\Old_App_Code\CMS\UpgradeProcedure.cs file for a web application installation. That file is normally only used as part of a Kentico upgrade, but a web site installation compiles it automatically (because the Windows 10 environment changed) and a web application installation would only compile it if a developer initiated a build. If the compiler detects an error, the result is the screen above.

There are a few ways to fix this. You could revert the Windows 10 update, but this is time-consuming, and your server would not get security updates. You could also upgrade Kentico, and while this is a good idea, you may not be prepared to do this yet. The simplest way to address the problem is to adjust that one line of code so Kentico can continue compiling and can properly display your great website.

To change the code, access your server, open that file in any text editor or Visual Studio, and change this:

.ToDictionary(group => group.Key, group => group.Select(u => u.Email).ToHashSet(StringComparer.InvariantCultureIgnoreCase));

to this:

.ToDictionary(group => group.Key, group => CMS.DataEngine.DataExtensions.ToHashSet(group.Select(u => u.Email), StringComparer.InvariantCultureIgnoreCase));

And save the file. Kentico will be able to compile without further issues. Don’t forget to apply the change to any other environments, such as for staging or web farm servers.

A related issue was fixed in hotfix 11.0.23, available for Kentico 11. Please see the Kentico hotfixes page for more information.

If you happen to see anything else unusual after applying that Windows 10 update, don’t hesitate to reach out to Kentico Support!

Share this article on   LinkedIn Google+