これは私が以前に何度か気づいた行動であり、その背後にある理由を知りたいと思います。(Visual Studio 2008)デバッガーで次のプログラムを実行すると、デバッグを継続する頻度に関係なく、デバッガーはthrow
ステートメントを中断し続けます。そこにたどり着くには、デバッグを停止する必要があります。デバッガーを使用せずにプログラムを実行すると、デバッガーが1回中断してから、プロセスが終了することが予想されます。誰かがこの振る舞いの正当な理由を知っていますか?
using System;
namespace ExceptionTest
{
static internal class Program
{
static internal void Main()
{
try
{
throw new Exception();
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
// The debuger will never go beyond
// the throw statement and terminate
// the process. Why?
throw;
}
}
}
}