3
Vote

The sorting by resource's version is wrong

description

If I register two resources with version 1.9 and version 1.11 then, the resource 1.9 will be selected in this code:
        var resource = (from p in ResourceProviders
                        from r in p.GetResources(type)
                        where name.Equals(r.Key, StringComparison.OrdinalIgnoreCase)
                        orderby r.Value.Version descending
                        select r.Value).FirstOrDefault();
of ResourceManager.FindResource() method.

This is because Version is a string so it's absolutely wrong to sort with default alphabet rules.

As a solution here the NumericComparer should be used instead.