diff --git a/ICSharpCode.Decompiler/DecompilerEventSource.cs b/ICSharpCode.Decompiler/DecompilerEventSource.cs
new file mode 100644
index 000000000..1ddf34573
--- /dev/null
+++ b/ICSharpCode.Decompiler/DecompilerEventSource.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.Tracing;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ICSharpCode.Decompiler.TypeSystem;
+using ICSharpCode.Decompiler.TypeSystem.Implementation;
+using Mono.Cecil;
+
+namespace ICSharpCode.Decompiler
+{
+ [EventSource(Name = "DecompilerEventSource")]
+ public sealed class DecompilerEventSource : EventSource
+ {
+ public static DecompilerEventSource Log = new DecompilerEventSource();
+
+ [Event(1, Level = EventLevel.Informational)]
+ public void Info(string text)
+ {
+ WriteEvent(1, text);
+ }
+ }
+}
diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
index 0f1025da8..b7f4ee584 100644
--- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
+++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
@@ -46,6 +46,7 @@
+
@@ -257,6 +258,7 @@
+
diff --git a/ILSpy/Commands/SortAssemblyListCommand.cs b/ILSpy/Commands/SortAssemblyListCommand.cs
index 2020cf21d..3fe50648b 100644
--- a/ILSpy/Commands/SortAssemblyListCommand.cs
+++ b/ILSpy/Commands/SortAssemblyListCommand.cs
@@ -36,4 +36,13 @@ namespace ICSharpCode.ILSpy
return string.Compare(x.ShortName, y.ShortName, StringComparison.CurrentCulture);
}
}
+
+ [ExportMainMenuCommand(Menu = "_View", Header = "_Output", MenuIcon = "Images/ViewCode.png", MenuCategory = "View")]
+ sealed class ShowLog : SimpleCommand
+ {
+ public override void Execute(object parameter)
+ {
+ LogWindow.Instance.Show();
+ }
+ }
}
diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj
index 80959eb0c..d990acb40 100644
--- a/ILSpy/ILSpy.csproj
+++ b/ILSpy/ILSpy.csproj
@@ -126,6 +126,7 @@
+
@@ -303,6 +304,9 @@
SearchPane.cs
+
+ LogWindow.xaml.cs
+
DecompilerTextView.cs
diff --git a/ILSpy/LogWindow.xaml b/ILSpy/LogWindow.xaml
new file mode 100644
index 000000000..02fc37dab
--- /dev/null
+++ b/ILSpy/LogWindow.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/ILSpy/LogWindow.xaml.cs b/ILSpy/LogWindow.xaml.cs
new file mode 100644
index 000000000..ab48a619f
--- /dev/null
+++ b/ILSpy/LogWindow.xaml.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.Tracing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using ICSharpCode.AvalonEdit;
+
+namespace ICSharpCode.ILSpy
+{
+ partial class LogWindow : UserControl, IPane
+ {
+ static LogWindow instance;
+
+ public static LogWindow Instance {
+ get {
+ if (instance == null) {
+ App.Current.VerifyAccess();
+ instance = new LogWindow();
+ }
+ return instance;
+ }
+ }
+
+ readonly AvalonEditEventListener listener;
+
+ private LogWindow()
+ {
+ InitializeComponent();
+ this.listener = new AvalonEditEventListener(this.log);
+ }
+
+ public void Show()
+ {
+ if (!IsVisible) {
+ MainWindow.Instance.ShowInBottomPane("Output", this);
+ }
+ }
+
+ public void Closed()
+ {
+
+ }
+
+ class AvalonEditEventListener : EventListener
+ {
+ private TextEditor editor;
+
+ public AvalonEditEventListener(TextEditor editor)
+ {
+ this.editor = editor ?? throw new ArgumentNullException(nameof(editor));
+ }
+
+ protected override void OnEventSourceCreated(EventSource eventSource)
+ {
+ if (eventSource.Name == "DecompilerEventSource")
+ EnableEvents(eventSource, EventLevel.LogAlways, EventKeywords.All);
+ }
+
+ protected override void OnEventWritten(EventWrittenEventArgs eventData)
+ {
+ editor.Dispatcher.InvokeAsync(() => WriteToLog(eventData));
+ }
+
+ private void WriteToLog(EventWrittenEventArgs eventData)
+ {
+ editor.AppendText(eventData.Payload[0] + Environment.NewLine);
+ editor.ScrollToEnd();
+ }
+ }
+ }
+}
diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs
index 40cae72ae..fdd06fa51 100644
--- a/ILSpy/TextView/DecompilerTextView.cs
+++ b/ILSpy/TextView/DecompilerTextView.cs
@@ -498,6 +498,7 @@ namespace ICSharpCode.ILSpy.TextView
if (i > 0)
textOutput.WriteLine();
+ DecompilerEventSource.Log.Info($"Decompilation started...");
context.Options.CancellationToken.ThrowIfCancellationRequested();
nodes[i].Decompile(context.Language, textOutput, context.Options);
}