views:

13

answers:

2

I use the async 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?

+1  A: 

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.

djechelon
+1  A: 

Breaking on all exceptions might help you to debug the problem:

alt text

You open this dialog window through Debug/Exceptions.

steinar