{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/bond/pulls/comments/59990928","id":59990928,"diff_hunk":"@@ -76,10 +77,23 @@ public class Serializer<W>\n         public Serializer(Type type, bool inlineNested)\n         {\n             var parser = new ObjectParser(type);\n-            serialize = SerializerGeneratorFactory<object, W>.Create(\n-                    (o, w, i) => serialize[i](o, w), type, inlineNested)\n-                .Generate(parser)\n-                .Select(lambda => lambda.Compile()).ToArray();\n+\n+            var firstPassAttribute = typeof(W).GetAttribute<FirstPassWriterAttribute>();\n+            if (firstPassAttribute != null)\n+            {\n+                if (!typeof(ITwoPassProtocolWriter).IsAssignableFrom(typeof(W)))\n+                {\n+                    throw new ArgumentException(\"Writers with FirstPassWriterAttribute must implement ITwoPassProtocolWriter\");\n+                }\n+\n+                Type firstPassHelperType = typeof(TwoPassSerializerHelper<>).MakeGenericType(typeof(W), firstPassAttribute.Type);\n+\n+                helper = (SerializerHelper)Activator.CreateInstance(firstPassHelperType, parser, type, inlineNested);\n+            }\n+            else\n+            {\n+                helper = new SerializerHelper(parser, type, inlineNested);\n+            }","path":"cs/src/core/Serializer.cs","position":null,"original_position":41,"commit_id":"d1521e9c8d76502389b3ba4b1e81bfb77acfd5d6","original_commit_id":"f404d2cb0a37ef3d4feb9dc321177f2711f3565f","user":{"login":"jdubrule","id":11828477,"avatar_url":"https://avatars.githubusercontent.com/u/11828477?v=3","gravatar_id":"","url":"https://api.github.com/users/jdubrule","html_url":"https://github.com/jdubrule","followers_url":"https://api.github.com/users/jdubrule/followers","following_url":"https://api.github.com/users/jdubrule/following{/other_user}","gists_url":"https://api.github.com/users/jdubrule/gists{/gist_id}","starred_url":"https://api.github.com/users/jdubrule/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdubrule/subscriptions","organizations_url":"https://api.github.com/users/jdubrule/orgs","repos_url":"https://api.github.com/users/jdubrule/repos","events_url":"https://api.github.com/users/jdubrule/events{/privacy}","received_events_url":"https://api.github.com/users/jdubrule/received_events","type":"User","site_admin":false},"body":"1.  Not sure how to cleanly merge Serializer&Transcoder, 'cause they use different helper types, have different # of generic parameters, and their constructors take different args.\r\n2.  Done.","created_at":"2016-04-17T19:38:34Z","updated_at":"2016-04-17T19:38:34Z","html_url":"https://github.com/Microsoft/bond/pull/146#discussion_r59990928","pull_request_url":"https://api.github.com/repos/Microsoft/bond/pulls/146","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/comments/59990928"},"html":{"href":"https://github.com/Microsoft/bond/pull/146#discussion_r59990928"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/146"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/bond/pulls/146","id":65826895,"html_url":"https://github.com/Microsoft/bond/pull/146","diff_url":"https://github.com/Microsoft/bond/pull/146.diff","patch_url":"https://github.com/Microsoft/bond/pull/146.patch","issue_url":"https://api.github.com/repos/Microsoft/bond/issues/146","number":146,"state":"open","locked":false,"title":"C# Compact Binary v2 serialization","user":{"login":"jdubrule","id":11828477,"avatar_url":"https://avatars.githubusercontent.com/u/11828477?v=3","gravatar_id":"","url":"https://api.github.com/users/jdubrule","html_url":"https://github.com/jdubrule","followers_url":"https://api.github.com/users/jdubrule/followers","following_url":"https://api.github.com/users/jdubrule/following{/other_user}","gists_url":"https://api.github.com/users/jdubrule/gists{/gist_id}","starred_url":"https://api.github.com/users/jdubrule/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdubrule/subscriptions","organizations_url":"https://api.github.com/users/jdubrule/orgs","repos_url":"https://api.github.com/users/jdubrule/repos","events_url":"https://api.github.com/users/jdubrule/events{/privacy}","received_events_url":"https://api.github.com/users/jdubrule/received_events","type":"User","site_admin":false},"body":"Implement Compact Binary v2 serialization support in C#, which previously only supported v2 deserialization (and both for v1)","created_at":"2016-04-08T18:23:23Z","updated_at":"2016-04-17T19:38:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00dea3fe7adddad4151a21d9044ec86ce94c6031","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/bond/pulls/146/commits","review_comments_url":"https://api.github.com/repos/Microsoft/bond/pulls/146/comments","review_comment_url":"https://api.github.com/repos/Microsoft/bond/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/bond/issues/146/comments","statuses_url":"https://api.github.com/repos/Microsoft/bond/statuses/d1521e9c8d76502389b3ba4b1e81bfb77acfd5d6","head":{"label":"jdubrule:csharp-compact-binary-v2","ref":"csharp-compact-binary-v2","sha":"d1521e9c8d76502389b3ba4b1e81bfb77acfd5d6","user":{"login":"jdubrule","id":11828477,"avatar_url":"https://avatars.githubusercontent.com/u/11828477?v=3","gravatar_id":"","url":"https://api.github.com/users/jdubrule","html_url":"https://github.com/jdubrule","followers_url":"https://api.github.com/users/jdubrule/followers","following_url":"https://api.github.com/users/jdubrule/following{/other_user}","gists_url":"https://api.github.com/users/jdubrule/gists{/gist_id}","starred_url":"https://api.github.com/users/jdubrule/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdubrule/subscriptions","organizations_url":"https://api.github.com/users/jdubrule/orgs","repos_url":"https://api.github.com/users/jdubrule/repos","events_url":"https://api.github.com/users/jdubrule/events{/privacy}","received_events_url":"https://api.github.com/users/jdubrule/received_events","type":"User","site_admin":false},"repo":{"id":50680993,"name":"bond","full_name":"jdubrule/bond","owner":{"login":"jdubrule","id":11828477,"avatar_url":"https://avatars.githubusercontent.com/u/11828477?v=3","gravatar_id":"","url":"https://api.github.com/users/jdubrule","html_url":"https://github.com/jdubrule","followers_url":"https://api.github.com/users/jdubrule/followers","following_url":"https://api.github.com/users/jdubrule/following{/other_user}","gists_url":"https://api.github.com/users/jdubrule/gists{/gist_id}","starred_url":"https://api.github.com/users/jdubrule/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdubrule/subscriptions","organizations_url":"https://api.github.com/users/jdubrule/orgs","repos_url":"https://api.github.com/users/jdubrule/repos","events_url":"https://api.github.com/users/jdubrule/events{/privacy}","received_events_url":"https://api.github.com/users/jdubrule/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdubrule/bond","description":"Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. ","fork":true,"url":"https://api.github.com/repos/jdubrule/bond","forks_url":"https://api.github.com/repos/jdubrule/bond/forks","keys_url":"https://api.github.com/repos/jdubrule/bond/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdubrule/bond/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdubrule/bond/teams","hooks_url":"https://api.github.com/repos/jdubrule/bond/hooks","issue_events_url":"https://api.github.com/repos/jdubrule/bond/issues/events{/number}","events_url":"https://api.github.com/repos/jdubrule/bond/events","assignees_url":"https://api.github.com/repos/jdubrule/bond/assignees{/user}","branches_url":"https://api.github.com/repos/jdubrule/bond/branches{/branch}","tags_url":"https://api.github.com/repos/jdubrule/bond/tags","blobs_url":"https://api.github.com/repos/jdubrule/bond/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdubrule/bond/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdubrule/bond/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdubrule/bond/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdubrule/bond/statuses/{sha}","languages_url":"https://api.github.com/repos/jdubrule/bond/languages","stargazers_url":"https://api.github.com/repos/jdubrule/bond/stargazers","contributors_url":"https://api.github.com/repos/jdubrule/bond/contributors","subscribers_url":"https://api.github.com/repos/jdubrule/bond/subscribers","subscription_url":"https://api.github.com/repos/jdubrule/bond/subscription","commits_url":"https://api.github.com/repos/jdubrule/bond/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdubrule/bond/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdubrule/bond/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdubrule/bond/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdubrule/bond/contents/{+path}","compare_url":"https://api.github.com/repos/jdubrule/bond/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdubrule/bond/merges","archive_url":"https://api.github.com/repos/jdubrule/bond/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdubrule/bond/downloads","issues_url":"https://api.github.com/repos/jdubrule/bond/issues{/number}","pulls_url":"https://api.github.com/repos/jdubrule/bond/pulls{/number}","milestones_url":"https://api.github.com/repos/jdubrule/bond/milestones{/number}","notifications_url":"https://api.github.com/repos/jdubrule/bond/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdubrule/bond/labels{/name}","releases_url":"https://api.github.com/repos/jdubrule/bond/releases{/id}","deployments_url":"https://api.github.com/repos/jdubrule/bond/deployments","created_at":"2016-01-29T18:07:09Z","updated_at":"2016-01-29T18:07:12Z","pushed_at":"2016-04-17T19:34:34Z","git_url":"git://github.com/jdubrule/bond.git","ssh_url":"git@github.com:jdubrule/bond.git","clone_url":"https://github.com/jdubrule/bond.git","svn_url":"https://github.com/jdubrule/bond","homepage":null,"size":3844,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"8995cafef60480c7b2d41159df010ce9380e235c","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":28014525,"name":"bond","full_name":"Microsoft/bond","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/bond","description":"Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. ","fork":false,"url":"https://api.github.com/repos/Microsoft/bond","forks_url":"https://api.github.com/repos/Microsoft/bond/forks","keys_url":"https://api.github.com/repos/Microsoft/bond/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/bond/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/bond/teams","hooks_url":"https://api.github.com/repos/Microsoft/bond/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/bond/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/bond/events","assignees_url":"https://api.github.com/repos/Microsoft/bond/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/bond/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/bond/tags","blobs_url":"https://api.github.com/repos/Microsoft/bond/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/bond/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/bond/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/bond/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/bond/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/bond/languages","stargazers_url":"https://api.github.com/repos/Microsoft/bond/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/bond/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/bond/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/bond/subscription","commits_url":"https://api.github.com/repos/Microsoft/bond/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/bond/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/bond/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/bond/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/bond/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/bond/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/bond/merges","archive_url":"https://api.github.com/repos/Microsoft/bond/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/bond/downloads","issues_url":"https://api.github.com/repos/Microsoft/bond/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/bond/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/bond/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/bond/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/bond/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/bond/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/bond/deployments","created_at":"2014-12-15T01:05:31Z","updated_at":"2016-04-17T14:31:24Z","pushed_at":"2016-04-17T19:34:34Z","git_url":"git://github.com/Microsoft/bond.git","ssh_url":"git@github.com:Microsoft/bond.git","clone_url":"https://github.com/Microsoft/bond.git","svn_url":"https://github.com/Microsoft/bond","homepage":null,"size":4272,"stargazers_count":1303,"watchers_count":1303,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":147,"mirror_url":null,"open_issues_count":35,"forks":147,"open_issues":35,"watchers":1303,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/146"},"html":{"href":"https://github.com/Microsoft/bond/pull/146"},"issue":{"href":"https://api.github.com/repos/Microsoft/bond/issues/146"},"comments":{"href":"https://api.github.com/repos/Microsoft/bond/issues/146/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/146/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/146/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/bond/statuses/d1521e9c8d76502389b3ba4b1e81bfb77acfd5d6"}}}}