{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/4777","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/4777/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/4777/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/4777/events","html_url":"https://github.com/dotnet/corefx/issues/4777","id":119999895,"number":4777,"title":"System.Net.Socket EndPoint-extensibility broken in corefx","user":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars.githubusercontent.com/u/2642209?v=3","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefx/labels/System.Net","name":"System.Net","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"CIPop","id":8635911,"avatar_url":"https://avatars.githubusercontent.com/u/8635911?v=3","gravatar_id":"","url":"https://api.github.com/users/CIPop","html_url":"https://github.com/CIPop","followers_url":"https://api.github.com/users/CIPop/followers","following_url":"https://api.github.com/users/CIPop/following{/other_user}","gists_url":"https://api.github.com/users/CIPop/gists{/gist_id}","starred_url":"https://api.github.com/users/CIPop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CIPop/subscriptions","organizations_url":"https://api.github.com/users/CIPop/orgs","repos_url":"https://api.github.com/users/CIPop/repos","events_url":"https://api.github.com/users/CIPop/events{/privacy}","received_events_url":"https://api.github.com/users/CIPop/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/4","html_url":"https://github.com/dotnet/corefx/milestones/1.0.0-rtm","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/4/labels","id":1248719,"number":4,"title":"1.0.0-rtm","description":"Q1 2016 (https://github.com/aspnet/Home/wiki/Roadmap)","creator":{"login":"joshfree","id":1302850,"avatar_url":"https://avatars.githubusercontent.com/u/1302850?v=3","gravatar_id":"","url":"https://api.github.com/users/joshfree","html_url":"https://github.com/joshfree","followers_url":"https://api.github.com/users/joshfree/followers","following_url":"https://api.github.com/users/joshfree/following{/other_user}","gists_url":"https://api.github.com/users/joshfree/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfree/subscriptions","organizations_url":"https://api.github.com/users/joshfree/orgs","repos_url":"https://api.github.com/users/joshfree/repos","events_url":"https://api.github.com/users/joshfree/events{/privacy}","received_events_url":"https://api.github.com/users/joshfree/received_events","type":"User","site_admin":false},"open_issues":227,"closed_issues":109,"state":"open","created_at":"2015-08-10T18:04:00Z","updated_at":"2015-12-10T18:01:52Z","due_on":"2016-03-31T07:00:00Z","closed_at":null},"comments":3,"created_at":"2015-12-02T17:55:30Z","updated_at":"2015-12-10T23:00:21Z","closed_at":null,"body":"The current corefx codebase appears to be closed off to any EndPoint customization.  The Sockets codebase expects every EndPoint to be either a DnsEndPoint or an IPEndPoint, and anything that’s not built in to System.Net.Sockets will result in failures.  This is a silly little quick example which obviously won’t do anything meaningful:\r\n```C#\r\nprivate class MyEndPoint : EndPoint { }\r\n\r\n[Fact]\r\npublic void Socket_CustomEndPoint()\r\n{\r\n    Socket s = new Socket(SocketType.Raw, ProtocolType.Raw);\r\n    s.Connect(new MyEndPoint());\r\n}\r\n```\r\nbut it fails on corefx due to a cast exception that highlights the problem:\r\n```\r\nSystem.InvalidCastException : Unable to cast object of type 'MyEndPoint' to type 'System.Net.IPEndPoint'.\r\n        Stack Trace:\r\n           c:\\Users\\stoub\\Source\\repos\\corefx\\src\\Common\\src\\System\\Net\\Internals\\IPEndPointExtensions.cs(14,0): at System.Net.Sockets.IPEndPointExtensions.Serialize(EndPoint endpoint)\r\n           c:\\Users\\stoub\\Source\\repos\\corefx\\src\\System.Net.Sockets\\src\\System\\Net\\Sockets\\Socket.cs(4894,0): at System.Net.Sockets.Socket.CheckCacheRemote(EndPoint& remoteEP, Boolean isOverwrite)\r\n           c:\\Users\\stoub\\Source\\repos\\corefx\\src\\System.Net.Sockets\\src\\System\\Net\\Sockets\\Socket.cs(848,0): at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)\r\n```\r\nIn contrast, on desktop it also fails but where and with the exception I’d expect:\r\n```\r\nUnhandled Exception: System.NotImplementedException: This method is not implemented by this class.\r\n   at System.Net.EndPoint.Serialize()\r\n   at System.Net.Sockets.Socket.CallSerializeCheckDnsEndPoint(EndPoint remoteEP)\r\n   at System.Net.Sockets.Socket.CheckCacheRemote(EndPoint& remoteEP, Boolean isOverwrite)\r\n   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)\r\n```\r\n\r\ncc: @cipop, @davidsh, @SidharthNabar "},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/163779817","html_url":"https://github.com/dotnet/corefx/issues/4777#issuecomment-163779817","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/4777","id":163779817,"user":{"login":"IlyaBiryukov","id":15989459,"avatar_url":"https://avatars.githubusercontent.com/u/15989459?v=3","gravatar_id":"","url":"https://api.github.com/users/IlyaBiryukov","html_url":"https://github.com/IlyaBiryukov","followers_url":"https://api.github.com/users/IlyaBiryukov/followers","following_url":"https://api.github.com/users/IlyaBiryukov/following{/other_user}","gists_url":"https://api.github.com/users/IlyaBiryukov/gists{/gist_id}","starred_url":"https://api.github.com/users/IlyaBiryukov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IlyaBiryukov/subscriptions","organizations_url":"https://api.github.com/users/IlyaBiryukov/orgs","repos_url":"https://api.github.com/users/IlyaBiryukov/repos","events_url":"https://api.github.com/users/IlyaBiryukov/events{/privacy}","received_events_url":"https://api.github.com/users/IlyaBiryukov/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T23:00:20Z","updated_at":"2015-12-10T23:00:20Z","body":"Hmm. That must be language services tricked me in VS when I tried to find the definition of SocketAddress in IPEndPoint.Serialize() in System.Net.Primitives.dll. I looked up SocketAddress and it is indeed in System.Net.Primitives.dll\r\n\r\nBut I guess the question still stands, why use it from System.Net.Sockets, why not the original one that EndPoint.Serialize() returns, from System.Net.Primitives?\r\n"}}