Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Best explained with a small repro:
//create new socket with Ipv6 address family
let s = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)
//do async connect against localhost
Async.FromBeginEnd((fun (ac, o) -> s.BeginConnect("localhost", 5234, ac, o)), s.EndConnect)
s.LocalEndPoint //accessing this throws
System.ArgumentException: The IPEndPoint was created using InterNetwork AddressFamily but SocketAddress contains InterNetworkV6 instead, please use the same type.
at System.Net.IPEndPoint.Create (System.Net.SocketAddress socketAddress) <0x7d509f8 + 0x0051b> in <filename unknown>:0
at System.Net.Sockets.Socket.get_LocalEndPoint () <0x7d50828 + 0x0005f> in <filename unknown>:0
at <StartupCode$FSI_0004>.$FSI_0004.main@ () <0x7d507a0 + 0x00017> in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object,System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) <0x267c270 + 0x000a1> in <filename unknown>:0
Stopped due to error
If you use the sync 'Connect' instead this does not happen.
I reproduce it with master.
It repros if you setup a socket listening on everything.
This is the snippet I used to setup the listening side:
var x = new TcpListener (IPAddress.Any, 5234);
var s = x.AcceptSocket();
I met this problem too.
The problem might be the remote endpoint is a IPV6 one but the local bind endpoint is IPv4 one.
This has been fixed.