Index: branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs	(revision 12515)
+++ branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs	(revision 12689)
@@ -25,9 +25,10 @@
 using System.Reflection;
 using System.Threading.Tasks;
+using System.Windows.Forms;
 using HeuristicLab.Common;
 using ICSharpCode.NRefactory.TypeSystem;
 
 namespace HeuristicLab.CodeEditor {
-  public class CodeEditorBase : System.Windows.Forms.UserControl {
+  public class CodeEditorBase : UserControl {
     public virtual string UserCode { get; set; }
 
Index: branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionStrategy.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionStrategy.cs	(revision 12515)
+++ branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionStrategy.cs	(revision 12689)
@@ -20,5 +20,4 @@
 #endregion
 
-using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -26,5 +25,4 @@
 using ICSharpCode.NRefactory.CSharp;
 using ICSharpCode.NRefactory.CSharp.Completion;
-using ICSharpCode.NRefactory.Editor;
 using ICSharpCode.NRefactory.TypeSystem;
 
@@ -112,11 +110,5 @@
 
     protected override void DoParseStep() {
-      var document = (IDocument)codeEditor.Invoke(
-        (Func<IDocument>)(() => {
-          var doc = codeEditor.TextEditor.Document;
-          return new ReadOnlyDocument(doc, doc.FileName);
-        })
-      );
-
+      if (document == null) return;
       var unresolvedFile = CSharpParsingHelpers.CreateCSharpUnresolvedFile(document);
       projectContent = projectContent.AddOrUpdateFiles(unresolvedFile);
Index: branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionStrategy.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionStrategy.cs	(revision 12515)
+++ branches/HiveStatistics/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionStrategy.cs	(revision 12689)
@@ -20,17 +20,28 @@
 #endregion
 
+using System;
 using System.Linq;
-using System.Threading;
 using System.Threading.Tasks;
 using ICSharpCode.AvalonEdit.CodeCompletion;
+using ICSharpCode.NRefactory.Editor;
+using Timer = System.Timers.Timer;
 
 namespace HeuristicLab.CodeEditor {
   internal abstract class CodeCompletionStrategy : ICodeCompletionStrategy {
     protected readonly CodeEditor codeEditor;
-    protected readonly Task backgroundParser;
+    protected readonly Timer parserTimer;
+    protected IDocument document;
 
     protected CodeCompletionStrategy(CodeEditor codeEditor) {
       this.codeEditor = codeEditor;
-      backgroundParser = new Task(DoBackgroundParsing);
+      this.codeEditor.TextEditorTextChanged += codeEditor_TextEditorTextChanged;
+      parserTimer = new Timer(1000);
+      parserTimer.Elapsed += (sender, args) => Task.Run(() => {
+        DoParseStep();
+        if (codeEditor.IsDisposed && parserTimer.Enabled) {
+          parserTimer.Stop();
+          parserTimer.Dispose();
+        }
+      });
     }
 
@@ -41,6 +52,5 @@
 
     public virtual void Initialize() {
-      if (backgroundParser.Status == TaskStatus.Created)
-        backgroundParser.Start();
+      parserTimer.Enabled = true;
     }
 
@@ -89,9 +99,7 @@
     }
 
-    protected virtual void DoBackgroundParsing() {
-      while (!codeEditor.IsDisposed) {
-        DoParseStep();
-        Thread.Sleep(1000);
-      }
+    private void codeEditor_TextEditorTextChanged(object sender, EventArgs e) {
+      var doc = codeEditor.TextEditor.Document;
+      document = new ReadOnlyDocument(doc, doc.FileName);
     }
   }
