static void Main(string[] args)
        {
            MyScenario1.MyNoExceptionFilter();
            MyScenario1.MyExceptionFilter();

            // NOTE:
            // When you enter a catch block, the stack is unwound:
            //      this means that the stack frames for the method calls “deeper” than the current method are dropped.
            //          This implies that all information about current execution state in those stack frames is lost,
            //              making it harder to identify the root cause of the exception.

            //
            //f1 (entered catch -- call stack will contain f3,f2,f1 - root cause details lost like line number in f5)
            //    f2
            //        f3 (entered catch -- call stack will contain  f5,f4,f3 - root cause details exist)   --- throw again here
            //            f4
            //                f5 (exception occurred - root cause in f5)
            //

            try
            {
                MyScenario2.MyExceptionFilter2();
            }
            catch (Exception e)
            {
                Console.WriteLine("MAIN CATCH - Finally caught exception in main(): ", e);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            MyScenario1.MyNoExceptionFilter();
            MyScenario1.MyExceptionFilter();

            // NOTE:
            // When you enter a catch block, the stack is unwound:
            //      this means that the stack frames for the method calls “deeper” than the current method are dropped.
            //          This implies that all information about current execution state in those stack frames is lost,
            //              making it harder to identify the root cause of the exception.

            try
            {
                MyScenario2.MyExceptionFilter2();
            }
            catch (Exception e)
            {
                Console.WriteLine("Finally caught exception in main(): ", e);
            }
        }