{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corert/issues/1684","repository_url":"https://api.github.com/repos/dotnet/corert","labels_url":"https://api.github.com/repos/dotnet/corert/issues/1684/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corert/issues/1684/comments","events_url":"https://api.github.com/repos/dotnet/corert/issues/1684/events","html_url":"https://github.com/dotnet/corert/issues/1684","id":172337267,"number":1684,"title":"Comparer<T?>.Default.Compare will not work in CoreRT","user":{"login":"jamesqo","id":9159214,"avatar_url":"https://avatars.githubusercontent.com/u/9159214?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesqo","html_url":"https://github.com/jamesqo","followers_url":"https://api.github.com/users/jamesqo/followers","following_url":"https://api.github.com/users/jamesqo/following{/other_user}","gists_url":"https://api.github.com/users/jamesqo/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesqo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesqo/subscriptions","organizations_url":"https://api.github.com/users/jamesqo/orgs","repos_url":"https://api.github.com/users/jamesqo/repos","events_url":"https://api.github.com/users/jamesqo/events{/privacy}","received_events_url":"https://api.github.com/users/jamesqo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-21T19:42:26Z","updated_at":"2016-08-21T20:36:44Z","closed_at":"2016-08-21T20:36:44Z","body":"For CoreCLR the `Comparer.Default` implementation is specialized for nullables so a simple nullable compare does not end up with virt method calls to `Comparer<T>.Default.Compare`. However, it looks like this is not done in the CoreRT version of `Comparer`, and since nullables do not implement `IComparable` it looks like they will reach this point: https://github.com/dotnet/corefx/blob/master/src/System.Collections/src/System/Collections/Generic/Comparer.cs#L113 where an exception will be thrown instead.\r\n\r\nThis also applies in a limited way to `EqualityComparer` (although not as severe); since `Nullable` is not an `IEquatable` it will call the `Equals(object)` instead of the `Equals(T)` overload of the underlying struct, and @jkotas you mentioned that might be a problem back in https://github.com/dotnet/coreclr/pull/6212#issuecomment-231632112.\r\n\r\nI realized this while I was working on some tests for `Comparer` in corefx...\r\n\r\ncc @jkotas"},"comment":{"url":"https://api.github.com/repos/dotnet/corert/issues/comments/241280452","html_url":"https://github.com/dotnet/corert/issues/1684#issuecomment-241280452","issue_url":"https://api.github.com/repos/dotnet/corert/issues/1684","id":241280452,"user":{"login":"jamesqo","id":9159214,"avatar_url":"https://avatars.githubusercontent.com/u/9159214?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesqo","html_url":"https://github.com/jamesqo","followers_url":"https://api.github.com/users/jamesqo/followers","following_url":"https://api.github.com/users/jamesqo/following{/other_user}","gists_url":"https://api.github.com/users/jamesqo/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesqo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesqo/subscriptions","organizations_url":"https://api.github.com/users/jamesqo/orgs","repos_url":"https://api.github.com/users/jamesqo/repos","events_url":"https://api.github.com/users/jamesqo/events{/privacy}","received_events_url":"https://api.github.com/users/jamesqo/received_events","type":"User","site_admin":false},"created_at":"2016-08-21T20:36:44Z","updated_at":"2016-08-21T20:36:44Z","body":"@MichalStrehovsky I did not realize that-- thank you for clarifying."}}
{"actor":{"display_login":"jamesqo"}}