marcodelpin / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

Unhandled exception in recently added NetUtility.ResolveAsync #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hey it's me again.

I just found out that Dns.EndGetHostEntry() throws a SocketException if the 
host could not be found. Since it's called inside the async callback, it's left 
uncaught and crashes the program.

This is undocumented behavior, only Dns.BeginGetHostEntry() is supposed to 
throw SocketException according to the docs:
 * http://msdn.microsoft.com/en-us/library/system.net.dns.begingethostentry.aspx
 * http://msdn.microsoft.com/en-us/library/system.net.dns.endgethostentry.aspx

Anyway, here's a patch that correctly handles SocketError.HostNotFound inside 
the callback. Other (hypothetical) exceptions are thrown (and are *uncatchable* 
by caller because they happen inside the callback).

Original issue reported on code.google.com by elise...@gmail.com on 1 Oct 2011 at 3:46

Attachments:

GoogleCodeExporter commented 9 years ago
Added in 267; thanks!

Original comment by lidg...@gmail.com on 3 Oct 2011 at 5:18