Example #1
0
        string GetExceptionMessage()
        {
            string  message = "";
            Version v       = Assembly.GetEntryAssembly().GetName().Version;

            message += "App Version : " + v.ToString() + Environment.NewLine;
            message += ".NET Version : " + Environment.Version.ToString() + Environment.NewLine;
            message += "OS Version : " + Environment.OSVersion.ToString() +
                       string.Format(", {0}bit", IntPtr.Size == 4 ? 32 : 64) + Environment.NewLine;

            string cultureName = null;

            try {
                cultureName = CultureInfo.CurrentCulture.Name;
                message    += "Current culture : " + CultureInfo.CurrentCulture.EnglishName +
                              " (" + cultureName + ")" + Environment.NewLine;
            } catch { }

            try {
                if (SystemInformation.TerminalServerSession)
                {
                    message += "Terminal Server Session" + Environment.NewLine;
                }
                if (SystemInformation.BootMode != BootMode.Normal)
                {
                    message += "Boot Mode            : " + SystemInformation.BootMode + Environment.NewLine;
                }
            } catch { }

            message += "Working Set Memory : " + (Environment.WorkingSet / 1024) + "kb" + Environment.NewLine;
            message += "GC Heap Memory : " + (GC.GetTotalMemory(false) / 1024) + "kb" + Environment.NewLine;
            message += Environment.NewLine;

            message += "Exception thrown : " + Environment.NewLine;
            message += ExceptionThrown.ToString();

            return(message);
        }