Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authortherzok <marius.ungureanu@xamarin.com>2019-05-30 18:02:39 +0300
committertherzok <marius.ungureanu@xamarin.com>2019-05-30 18:02:39 +0300
commit5790889871c9add4be64ef2d26a34a3f6ac5c188 (patch)
treebfadade9ca86c0eb8b82a180f560b2661c02d3c9 /main
parentb315e90910728b56a11f0eecc1e768e86aebdeb2 (diff)
Add comment on why we need to avoid appending stacktrace when we're logging an exception
Diffstat (limited to 'main')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/GLibLogging.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/GLibLogging.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/GLibLogging.cs
index 9aaa7ceddc..21a4593f6d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/GLibLogging.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/GLibLogging.cs
@@ -287,9 +287,13 @@ namespace MonoDevelop.Ide.Gui
LoggingService.LogError ("Disabling glib logging for the rest of the session");
}
+ static bool IsMono = Type.GetType ("Mono.Runtime") != null;
+
static string GetStacktraceIfNeeded (LogLevelFlags flags)
{
- if (flags.HasFlag (LogLevelFlags.Error | LogLevelFlags.Critical))
+ // If it's an Error or a Critical message, we're going to add the stacktrace via the logged exception property,
+ // we don't need to append it to the message in the log. But we are only doing so on Mono, nowhere else.
+ if (IsMono && flags.HasFlag (LogLevelFlags.Error | LogLevelFlags.Critical))
return string.Empty;
return "Stack trace: \n" + new StackTrace (1, true);
@@ -306,9 +310,11 @@ namespace MonoDevelop.Ide.Gui
// HACK: We need to somehow inject our stacktrace, and this is the only way we can
// This is not to transform every glib error into a managed exception
- typeof (Exception)
- .GetField ("captured_traces", flags)
- ?.SetValue (this, new StackTrace [] { trace });
+ if (IsMono) {
+ typeof (Exception)
+ .GetField ("captured_traces", flags)
+ ?.SetValue (this, new StackTrace [] { trace });
+ }
}
public override string StackTrace => trace.ToString ();