I am developing a console-based .NET application (using mono). I'm using asynchronous I/O (Begin/EndReceive).
I'm in the middle of a callback chain several layers deep, and if an exception is thrown, it is not being trapped anywhere (having it bubble out to the console is what I would expect, as there is currently no exception handling).
However, looking at the stack trace when I log it at the point where it occurs, the stack doesn't show it reaching back to the initial point-of-execution.
I've tried the AppDomain.UnhandledException trick, but that doesn't work in this situation.
System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: size
at System.Net.Sockets.Socket.BeginReceive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags socket_flags, System.AsyncCallback callback, System.Object state) [0x00000]
at MyClass+State.BeginReceive () [0x00000]