diff --git a/EndlessClient/GameExecution/EndlessGame.cs b/EndlessClient/GameExecution/EndlessGame.cs index f08569d2..684693e6 100644 --- a/EndlessClient/GameExecution/EndlessGame.cs +++ b/EndlessClient/GameExecution/EndlessGame.cs @@ -218,7 +218,6 @@ protected override void Update(GameTime gameTime) } } - protected override void Draw(GameTime gameTime) { var isTestMode = _controlSetRepository.CurrentControlSet.GameState == GameStates.TestMode; @@ -308,10 +307,8 @@ private void ShowExceptionDetailDialog(Exception ex) _contentProvider.Fonts[Constants.FontSize08pt5], insertLineBreaks: true, linkClickActions: [() => GithubIssueGenerator.FileIssue(ex)], - $"Client caused an exception: {ex.Message}", - ex.StackTrace, - $"Inner exception: {ex.InnerException?.Message ?? "(no inner exception)"}", - ex.InnerException?.StackTrace ?? "(no innner stacktrace)", + $"Client caused an exception", + ex.ToString(), "*Report this exception as a GitHub issue"); dlg.ShowDialog(); } diff --git a/EndlessClient/GameExecution/GithubIssueGenerator.cs b/EndlessClient/GameExecution/GithubIssueGenerator.cs index bbbe3f4c..418be1bb 100644 --- a/EndlessClient/GameExecution/GithubIssueGenerator.cs +++ b/EndlessClient/GameExecution/GithubIssueGenerator.cs @@ -1,8 +1,8 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.Runtime.InteropServices; -using System.Text.Encodings.Web; using System.Text; -using System; +using System.Text.Encodings.Web; namespace EndlessClient.GameExecution { @@ -33,8 +33,23 @@ private static string BuildIssueUrl(Exception ex) { var sb = new StringBuilder("https://github.com/ethanmoffat/EndlessClient/issues/new?"); - sb.Append("labels=bug,userreport"); - sb.Append($"&title=Unhandled+Client+Exception+Needs+Triage"); + string crashMethod; + try + { + crashMethod = ex.InnerException == null + ? ex.StackTrace.Split(' ', StringSplitOptions.RemoveEmptyEntries)[1] + : ex.InnerException.StackTrace.Split(' ', StringSplitOptions.RemoveEmptyEntries)[1]; + crashMethod = crashMethod[..crashMethod.IndexOf('(')]; + } + catch + { + crashMethod = string.Empty; + } + + var title = $"Unhandled+Client+Exception{(crashMethod == "" ? "" : $" in {crashMethod}")}"; + sb.Append($"title={UrlEncoder.Default.Encode(title)}"); + + sb.Append("&labels=bug,userreport"); sb.Append("&assignees=ethanmoffat"); var body = @$"Thank you for your report! Please fill in the following information to help me better triage/resolve this issue. @@ -50,26 +65,10 @@ private static string BuildIssueUrl(Exception ex) **Expected behavior (other than it not crashing)?** -*Diagnostic Information added automatically. Please do not delete!* - -**Exception message**: {ex.Message} -**Stack Trace**: -``` -{ex.StackTrace} -```"; - - if (ex.InnerException != null) - { - body += @$" +**Diagnostic Information** -**Inner Exception**: {ex.InnerException.Message} -**Stack Trace**: -``` -{ex.InnerException.StackTrace} -``` +{ex} "; - } - var encoded = UrlEncoder.Default.Encode(body); sb.Append($"&body={encoded}");