U4-2315 - YSOD: "At least one object must implement IComparable" after upgrading to 6.1.1

Created by Asbjørn Riis-Knudsen 03 Jun 2013, 18:16:00 Updated by Shannon Deminick 24 Jun 2013, 23:58:01

I upgraded a site from 6.0.6 to 6.1.1 and immediately after going through the installer, I got a YSOD with the follow message. This is clearly related to ClientDependency. This site is all MVC Views with ClientDependency used for all css and js in the front-end.

Mindst ét objekt skal implementere IComparable. [At least one object must implement IComparable] Beskrivelse: Der opstod en undtagelse, der ikke blev behandlet, under udførelse af den aktuelle webanmodning. Se staksporingen for at få flere oplysninger om fejlen, og hvor den kom fra i koden.

Detaljer om undtagelse: System.ArgumentException: Mindst ét objekt skal implementere IComparable.

Kildefejl:

Linje 407: Linje 408: //group by the group and order by the value Linje 409: foreach (var group in allDependencies.GroupBy(x => x.Group).OrderBy(x => x)) Linje 410: { Linje 411: //sort both the js and css dependencies properly

Kildefil: d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Core\FileRegistration\Providers\BaseFileRegistrationProvider.cs Linje: 409

Staksporing:

[ArgumentException: Mindst ét objekt skal implementere IComparable.] System.Collections.Comparer.Compare(Object a, Object b) +10788796 System.Collections.Generic.ObjectComparer1.Compare(T x, T y) +36 System.Linq.EnumerableSorter2.CompareKeys(Int32 index1, Int32 index2) +94 System.Linq.EnumerableSorter1.QuickSort(Int32[] map, Int32 left, Int32 right) +87 System.Linq.EnumerableSorter1.Sort(TElement[] elements, Int32 count) +73 System.Linq.d__0.MoveNext() +178 ClientDependency.Core.FileRegistration.Providers.BaseFileRegistrationProvider.WriteDependencies(List1 allDependencies, HashSet1 paths, String& jsOutput, String& cssOutput, HttpContextBase http) in d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Core\FileRegistration\Providers\BaseFileRegistrationProvider.cs:409 ClientDependency.Core.FileRegistration.Providers.BaseRenderer.RegisterDependencies(List1 allDependencies, HashSet1 paths, String& jsOutput, String& cssOutput, HttpContextBase http) in d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Core\FileRegistration\Providers\BaseRenderer.cs:22 ClientDependency.Core.Mvc.DependencyRenderer.GenerateOutput() in d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Mvc\DependencyRenderer.cs:179 ClientDependency.Core.Mvc.DependencyRenderer.ParseHtmlPlaceholders(String html) in d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Mvc\DependencyRenderer.cs:105 ClientDependency.Core.Mvc.MvcFilter.UpdateOutputHtml(String html) in d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Mvc\MvcFilter.cs:56 ClientDependency.Core.Module.ResponseFilterStream.OnTransformCompleteStringInternal(MemoryStream ms) in d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Core\Module\ResponseFilterStream.cs:241 ClientDependency.Core.Module.ResponseFilterStream.Flush() in d:\Hentede filer\Programmering\CMS\Umbraco\ClientDependency-master\ClientDependency-master\ClientDependency.Core\Module\ResponseFilterStream.cs:325 System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) +9623861 System.Web.HttpResponse.FilterOutput() +104 System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +49 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Comments

Asbjørn Riis-Knudsen 03 Jun 2013, 18:33:54

This turns out to be really simple to fix: The problem is in the LINQ statement on line 409 of BaseFileRegistrationProvider.cs. It tries ordering the results after grouping, but fails to specify what to order by. It currently looks like this: foreach (var group in allDependencies.GroupBy(x => x.Group).OrderBy(x => x)) Changing it to this makes it work. It seems that it was forgotten to sort by the group key. foreach (var group in allDependencies.GroupBy(x => x.Group).OrderBy(x => x.Key)) In my testing, this makes everything work again.


Shannon Deminick 03 Jun 2013, 22:57:31

Nice spot! I'll fix asap and post a new CDF release on nuget. Then you can use that new version as a work around until 6.1.2 is released.


Shannon Deminick 03 Jun 2013, 23:03:16

Here's the new Nuget package: https://nuget.org/packages/ClientDependency/1.7.0.2


Shannon Deminick 03 Jun 2013, 23:08:10

Will probably patch not just the 6.1.2 version but other Umbraco versions as well since this particular bug will exist in the CDF core there too. Perhaps it's reared it's head because we are using CDF groups in a later version of Umbraco.


Asbjørn Riis-Knudsen 03 Jun 2013, 23:16:27

I think this code was only added in CDF 1.7. Umbraco 6.0 uses CDF 1.5 which doesn't have this problem. The site ran 6.0.6 previously with exactly the same configuration and no issues.


Shannon Deminick 03 Jun 2013, 23:25:44

Yeah just saw that thanks!


Shannon Deminick 24 Jun 2013, 23:57:55

was fixed in 932115585e8f579bcf2b2a0061a5f878ba9bf627


Priority: Show-stopper

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted: Inline code

Affected versions: 6.1.1

Due in version: 6.1.2

Sprint:

Story Points:

Cycle: