仕事中に質問があったので、簡単なサンプルで確認。
class Program { static void Main(string[] args) { try { Bar bar = new Bar(); bar.DoTest(); } catch(Exception ex) { Console.WriteLine("==========Exception 再スロー後=========="); Console.WriteLine(ex.StackTrace); Console.WriteLine(); } Console.ReadLine(); } } public class Foo { public void DoTest() { throw new Exception(); } } public class Bar { public void DoTest() { try { Foo foo = new Foo(); foo.DoTest(); } catch (Exception ex) { Console.WriteLine("==========Exception 再スロー前=========="); Console.WriteLine(ex.StackTrace); throw ex; } } }
新しい内容で上書きされちゃうのね。元の内容に追加してくたらいいのに。