开发者

Debug .NET Socket callbacks

开发者 https://www.devze.com 2023-01-21 11:50 出处:网络
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 char

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:

Debug .NET Socket callbacks

You open this dialog window through Debug/Exceptions.

0

精彩评论

暂无评论...
验证码 换一张
取 消