calls GetBaseException and outputs the error message of the initial exception.

image_pdfimage_print
   
 

using System;

public class Starter {
    public static void Main() {
        try {
            MethodA();
        } catch (Exception except) {
            Exception original = except.GetBaseException();
            Console.WriteLine(original.Message);
        }
    }

    public static void MethodA() {
        try {
            MethodB();
        } catch (Exception except) {
            throw new ApplicationException("Inner Exception", except);
        }
    }

    public static void MethodB() {
        throw new ApplicationException("Innermost Exception");
    }
}