public static void ShowError()

in wwauth/Google.Solutions.WWAuth/View/ErrorDialog.cs [36:75]


        public static void ShowError(
            IWin32Window parent,
            string caption,
            Exception e)
        {
            Debug.Assert(!(parent is Control control) || !control.InvokeRequired);

            e = e.Unwrap();

            var details = new StringBuilder();

            for (var innerException = e.InnerException;
                    innerException != null; innerException =
                    innerException.InnerException)
            {
                details.Append(e.InnerException.GetType().Name);
                details.Append(":\n");
                details.Append(innerException.Message);
                details.Append("\n");
            }

            var config = new NativeMethods.TASKDIALOGCONFIG()
            {
                cbSize = (uint)Marshal.SizeOf(typeof(NativeMethods.TASKDIALOGCONFIG)),
                hwndParent = parent?.Handle ?? IntPtr.Zero,
                dwFlags = 0,
                dwCommonButtons = NativeMethods.TASKDIALOG_COMMON_BUTTON_FLAGS.TDCBF_OK_BUTTON,
                pszWindowTitle = "An error occured",
                MainIcon = NativeMethods.TD_ERROR_ICON,
                pszMainInstruction = caption,
                pszContent = e.Message,
                pszExpandedInformation = details.ToString()
            };

            NativeMethods.TaskDialogIndirect(
                ref config,
                out _,
                out _,
                out _);
        }