c# - Why is Visual Studio skipping over my Exception from a ThreadPool work item? -
I know about this other, but it does not apply to my situation.
First of all, here's my environment:
Windows XP 64-bit SP3; Visual Studio 2008 Y / SP; .NET 3.5 SP1; WPF application
My problem is that I can not see the move where my exception occurs. This only prevents the debugging session from continuing.
Here is some code - I have not written all of it, so please do not require comments on naming :)
// Start the WPF application // checked Set ToggleButton channelButton1 = New Handler for ToggleButton (); Channel Button 1 Checked + = (S, E) => ThreadPool.QueueUserWorkItem (SetTcpChannel, 1); Then in that SetTcpChannel method:
try {int channel = (int) position; EnsureTcpSocket (); // More logic to stuff with the channel // That does not care about us SO ... hold (exception e) {// just for example // this is where it comes back to me The code was expected ...} And finally, at the place where the exception is actually (inside EnsureTcpSocket ):
if (_tcp == null) {// This is not a valid IP / port because // target machine is not running (test condition) // Well ok, I want to get some exception And debugging should continue ... right? _tcp = new TcpClient (IP, port); } This is what I am doing:
- I set breakpoints on the
anticipate_pipset line,SetTcpChannel - F11 (step in)
EnsureTcpSocketso try me the code_tcp -
TcpClientconstructor for F10 (phase-over)
In that final step, the application comes back again and is running and I can No exceptions appear
Any thoughts?
How long have you been waiting? Depending on the logic it depends on the exact TcpClient constructor can wait for the time before throwing an exception. (If the connection has been rejected, this is a different matter.)
Comments
Post a Comment