private static void DisplayException(Form form, Exception ex) { if (form != null && form.InvokeRequired) { form.Invoke(new Action <Form, Exception>(DisplayException), new object[] { form, ex }); } else { TextBoxForm txt = new TextBoxForm(); txt.Text = "Unexpected Error"; txt.HeaderText = "An unexpected error occurred. Please submit the error report by clicking the link below. The report has been copied to your clipboard." + Environment.NewLine; txt.DisplayText = ex.ToString(); txt.SetLink("Click here to submit", GitHubRepository); Clipboard.SetText(txt.DisplayText); if (form == null) { txt.ShowDialog(); } else { txt.StartPosition = FormStartPosition.CenterParent; txt.ShowDialog(form); } } }