{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/5434","repository_url":"https://api.github.com/repos/dotnet/coreclr","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/5434/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/5434/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/5434/events","html_url":"https://github.com/dotnet/coreclr/pull/5434","id":158254212,"number":5434,"title":"Remove unnecessary arg validation in ByteEqualityComaprer.IndexOf","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":[{"url":"https://api.github.com/repos/dotnet/coreclr/labels/cla-already-signed","name":"cla-already-signed","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-02T22:30:02Z","updated_at":"2016-06-02T23:28:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/5434","html_url":"https://github.com/dotnet/coreclr/pull/5434","diff_url":"https://github.com/dotnet/coreclr/pull/5434.diff","patch_url":"https://github.com/dotnet/coreclr/pull/5434.patch"},"body":"`ByteEqualityComparer.IndexOf` validates its arguments before doing anything to them. Since it doesn't do the same for `LastIndexOf`, and nowhere any else in the file are arguments validated (including other comparers' `IndexOf` methods), I've replaced all of the `throw` clauses with `Contract.Assert` blocks. (These checks are eliminated in Release builds.)\r\n\r\ncc @jkotas @hughbe "},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/223452472","html_url":"https://github.com/dotnet/coreclr/pull/5434#issuecomment-223452472","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/5434","id":223452472,"user":{"login":"jkotas","id":6668460,"avatar_url":"https://avatars.githubusercontent.com/u/6668460?v=3","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T23:28:53Z","updated_at":"2016-06-02T23:28:53Z","body":"There is unsafe operation that follows. We prefer to have explicit argument validation as part of the unsafe operation as security best practice (unless there is a strong reason to not have it). It saved us from many MSRC events. You can find number of places in frameworks where similar potentially redundant argument validation is done before unsafe operation."}}
{"actor":{"display_login":"jkotas"}}