{"action":"created","issue":{"url":"https://api.github.com/repos/reactiveui/ReactiveUI/issues/1069","repository_url":"https://api.github.com/repos/reactiveui/ReactiveUI","labels_url":"https://api.github.com/repos/reactiveui/ReactiveUI/issues/1069/labels{/name}","comments_url":"https://api.github.com/repos/reactiveui/ReactiveUI/issues/1069/comments","events_url":"https://api.github.com/repos/reactiveui/ReactiveUI/issues/1069/events","html_url":"https://github.com/reactiveui/ReactiveUI/pull/1069","id":131819836,"number":1069,"title":"Add Ensure for more consistent guard code","user":{"login":"kentcb","id":1901832,"avatar_url":"https://avatars.githubusercontent.com/u/1901832?v=3","gravatar_id":"","url":"https://api.github.com/users/kentcb","html_url":"https://github.com/kentcb","followers_url":"https://api.github.com/users/kentcb/followers","following_url":"https://api.github.com/users/kentcb/following{/other_user}","gists_url":"https://api.github.com/users/kentcb/gists{/gist_id}","starred_url":"https://api.github.com/users/kentcb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentcb/subscriptions","organizations_url":"https://api.github.com/users/kentcb/orgs","repos_url":"https://api.github.com/users/kentcb/repos","events_url":"https://api.github.com/users/kentcb/events{/privacy}","received_events_url":"https://api.github.com/users/kentcb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/reactiveui/ReactiveUI/milestones/2","html_url":"https://github.com/reactiveui/ReactiveUI/milestones/ReactiveUI%207.0","labels_url":"https://api.github.com/repos/reactiveui/ReactiveUI/milestones/2/labels","id":1469357,"number":2,"title":"ReactiveUI 7.0","description":null,"creator":{"login":"ghuntley","id":127353,"avatar_url":"https://avatars.githubusercontent.com/u/127353?v=3","gravatar_id":"","url":"https://api.github.com/users/ghuntley","html_url":"https://github.com/ghuntley","followers_url":"https://api.github.com/users/ghuntley/followers","following_url":"https://api.github.com/users/ghuntley/following{/other_user}","gists_url":"https://api.github.com/users/ghuntley/gists{/gist_id}","starred_url":"https://api.github.com/users/ghuntley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghuntley/subscriptions","organizations_url":"https://api.github.com/users/ghuntley/orgs","repos_url":"https://api.github.com/users/ghuntley/repos","events_url":"https://api.github.com/users/ghuntley/events{/privacy}","received_events_url":"https://api.github.com/users/ghuntley/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":23,"state":"open","created_at":"2015-12-21T10:54:22Z","updated_at":"2016-02-06T04:55:43Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-02-06T04:55:43Z","updated_at":"2016-02-06T13:29:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/reactiveui/ReactiveUI/pulls/1069","html_url":"https://github.com/reactiveui/ReactiveUI/pull/1069","diff_url":"https://github.com/reactiveui/ReactiveUI/pull/1069.diff","patch_url":"https://github.com/reactiveui/ReactiveUI/pull/1069.patch"},"body":"Fixes #1036 by adding an internal `Ensure` class. This class contains static methods to validate arguments and check conditions.\r\n\r\n* I'm not super happy with the method names `ConditionSupported` and `ConditionValid` - ideas welcome\r\n* I may not have always chosen the best-fit exception type - any suggested tweaks welcome\r\n* I did not obsessively replace every `throw` with `Ensure` - it wasn't always a good fit and ain't nobody got time for that\r\n* The tests all pass but there's a chance I stuffed up one of the `Ensure` calls and no test exercises it"},"comment":{"url":"https://api.github.com/repos/reactiveui/ReactiveUI/issues/comments/180765280","html_url":"https://github.com/reactiveui/ReactiveUI/pull/1069#issuecomment-180765280","issue_url":"https://api.github.com/repos/reactiveui/ReactiveUI/issues/1069","id":180765280,"user":{"login":"kentcb","id":1901832,"avatar_url":"https://avatars.githubusercontent.com/u/1901832?v=3","gravatar_id":"","url":"https://api.github.com/users/kentcb","html_url":"https://github.com/kentcb","followers_url":"https://api.github.com/users/kentcb/followers","following_url":"https://api.github.com/users/kentcb/following{/other_user}","gists_url":"https://api.github.com/users/kentcb/gists{/gist_id}","starred_url":"https://api.github.com/users/kentcb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentcb/subscriptions","organizations_url":"https://api.github.com/users/kentcb/orgs","repos_url":"https://api.github.com/users/kentcb/repos","events_url":"https://api.github.com/users/kentcb/events{/privacy}","received_events_url":"https://api.github.com/users/kentcb/received_events","type":"User","site_admin":false},"created_at":"2016-02-06T13:29:24Z","updated_at":"2016-02-06T13:29:24Z","body":"@flagbug my understanding of this (which is limited in the context of Xamarin's application of IL) is that string interning essentially makes this into a non-issue. This is the reason I added overloads to avoid calls to `String.Format` - all arguments can be passed as constants, thus avoiding allocations.\r\n\r\nAre you saying that the allocation will occur every time the `ldstr` occurs? Because that would shock me."}}