1

私はこの他の投稿を認識していますが、私の状況には当てはまらないようです。

まず、私の環境は次のとおりです
。Windows XP 64 ビット SP3。Visual Studio 2008 SP 付き。.NET 3.5 SP1; WPF アプリケーション。

私の問題は、例外が発生した場所に足を踏み入れることができないことです。デバッグセッションを続行する代わりに、実行を続けるだけです。

ここにいくつかのコードがあります-私はそれをすべて書いたわけではないので、命名に関するコメントは必要ありません:)

// start up the WPF application
// set the handler for the Checked event
ToggleButton channelButton1 = new ToggleButton();
channelButton1.Checked += (s, e) => 
     ThreadPool.QueueUserWorkItem(SetTcpChannel, 1);

次に、そのSetTcpChannelメソッドで:

    try
    {
        int channel = (int)state;
        EnsureTcpSocket();
        // more logic to do stuff with channel 
        // that we don't care about for SO
        ...
    }
    catch (Exception e)
    {
        // just for illustration
        // this is where I expected the code to return
        ...
    }

そして最後に、実際に例外が発生する場所 ( 内EnsureTcpSocket):

    if (_tcp == null)
    {
        // this is not a valid ip/port since the 
        // target machine is not running (test condition)
        // but that's ok, I should get some exception 
        // and continue debugging...right?
        _tcp = new TcpClient(ip, port);
    }

これが私がやっていることです:

  1. EnsureTcpSocket内の行に ブレークポイントを設定し SetTcpChannel
  2. F11 (ステップ イン)で、コードEnsureTcpSocket の一部を確認できます_tcp
  3. TcpClientコンストラクターを F10 (ステップオーバー) してみてください

その最後のステップで、アプリケーションはデバッガーから戻ってきて実行を続け、例外は見られません。

何か案は?

4

2 に答える 2