I use the async 开发者_Python百科BeginReceive method of System.Net.Sockets.Socket. This requires a callback to an OnReceive function. However, nothing bugging in this section seems to be taken in charge by the debugger. So if anything goes wrong (uncatched exception), the app just crashes. Any idea how to fix that?
You should protect your callback with a try-catch block to prevent the application from crashing. You can also set a debugger breakpoint on the start of your callback to trace it. The best point, on first instance, is the catch statement, so you read what's the problem once you reach it.
Breaking on all exceptions might help you to debug the problem:
You open this dialog window through Debug/Exceptions.
精彩评论