Index: /trunk/sources/HeuristicLab.Core/PersistenceManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.Core/PersistenceManager.cs	(revision 401)
+++ /trunk/sources/HeuristicLab.Core/PersistenceManager.cs	(revision 402)
@@ -25,4 +25,5 @@
 using System.Xml;
 using System.IO;
+using System.IO.Compression;
 
 namespace HeuristicLab.Core {
@@ -86,4 +87,17 @@
     }
 
+    public static IStorable RestoreFromGZip(byte[] serializedStorable) {
+      GZipStream stream = new GZipStream(new MemoryStream(serializedStorable), CompressionMode.Decompress);
+      return Load(stream);
+    }
+
+    public static byte[] SaveToGZip(IStorable storable) {
+      MemoryStream memStream = new MemoryStream();
+      GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true);
+      Save(storable, stream);
+      stream.Close();
+      return memStream.ToArray();
+    }
+
     public static string BuildTypeString(Type type) {
       string assembly = type.Assembly.FullName;
Index: /trunk/sources/HeuristicLab.Grid/ClientForm.cs
===================================================================
--- /trunk/sources/HeuristicLab.Grid/ClientForm.cs	(revision 401)
+++ /trunk/sources/HeuristicLab.Grid/ClientForm.cs	(revision 402)
@@ -33,6 +33,6 @@
 using System.Threading;
 using System.IO;
-using System.IO.Compression;
 using System.Net;
+using System.Diagnostics;
 
 namespace HeuristicLab.Grid {
@@ -61,4 +61,7 @@
     private void startButton_Click(object sender, EventArgs e) {
       try {
+        Trace.Listeners.Clear();
+        Trace.Listeners.Add(new EventLogTraceListener("HeuristicLab.Grid"));
+
         ResetConnection();
         fetchOperationTimer.Start();
@@ -77,4 +80,5 @@
 
     private void ResetConnection() {
+      Trace.TraceInformation("Reset connection in GridClient");
       NetTcpBinding binding = new NetTcpBinding();
       binding.MaxReceivedMessageSize = 100000000; // 100Mbytes
@@ -112,4 +116,5 @@
           gotEngine = engineStore.TryTakeEngine(out currentGuid, out engineXml);
         } catch(TimeoutException) {
+          Trace.TraceWarning("TimeoutException while trying to get an engine");
           currentEngine = null;
           currentGuid = Guid.Empty;
@@ -118,4 +123,5 @@
           fetchOperationTimer.Start();
         } catch(CommunicationException) {
+          Trace.TraceWarning("CommunicationException while trying to get an engine");
           // connection problem -> reset connection and start the timer again
           ResetConnection();
@@ -156,8 +162,10 @@
               success = true;
             } catch(TimeoutException) {
+              Trace.TraceWarning("TimeoutException while trying to store the result of an engine");
               success = false;
               retries++;
               Thread.Sleep(TimeSpan.FromSeconds(CONNECTION_RETRY_TIMEOUT_SEC));
             } catch(CommunicationException) {
+              Trace.TraceWarning("CommunicationException while trying to store the result of an engine");
               ResetConnection();
               success = false;
@@ -180,13 +188,8 @@
 
     private ProcessingEngine RestoreEngine(byte[] engine) {
-      GZipStream stream = new GZipStream(new MemoryStream(engine), CompressionMode.Decompress);
-      return (ProcessingEngine)PersistenceManager.Load(stream);
+      return (ProcessingEngine)PersistenceManager.RestoreFromGZip(engine);
     }
     private byte[] SaveEngine(IEngine engine) {
-      MemoryStream memStream = new MemoryStream();
-      GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true);
-      PersistenceManager.Save(engine, stream);
-      stream.Close();
-      return memStream.ToArray();
+      return PersistenceManager.SaveToGZip(engine);
     }
   }
Index: /trunk/sources/HeuristicLab.Grid/JobManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.Grid/JobManager.cs	(revision 401)
+++ /trunk/sources/HeuristicLab.Grid/JobManager.cs	(revision 402)
@@ -29,5 +29,4 @@
 using HeuristicLab.Core;
 using System.IO;
-using System.IO.Compression;
 using System.Windows.Forms;
 using System.Diagnostics;
@@ -69,4 +68,6 @@
 
     public JobManager(string address) {
+      Trace.Listeners.Clear();
+      Trace.Listeners.Add(new EventLogTraceListener("HeuristicLab.Grid"));
       this.address = address;
       Thread starterThread = new Thread(StartEngines);
@@ -93,4 +94,5 @@
 
     private void ResetConnection() {
+      Trace.TraceInformation("Reset connection in JobManager");
       lock(connectionLock) {
         // open a new channel
@@ -139,6 +141,6 @@
           }
         }
-      } finally {
-        Debug.Assert(false);  // make sure that we are notified when this thread is stopped in debugging
+      } catch(Exception e) {
+        Trace.TraceError("Exception "+e+" in JobManager.StartEngines() killed the start-engine thread\n"+e.StackTrace);
       }
     }
@@ -181,6 +183,6 @@
           }
         }
-      } finally {
-        Debug.Assert(false); // just to make sure that I get notified when debugging whenever this thread is killed somehow
+      } catch(Exception e) {
+        Trace.TraceError("Exception " + e + " in JobManager.GetResults() killed the results-gathering thread\n"+ e.StackTrace);
       }
     }
@@ -199,11 +201,5 @@
 
     private byte[] ZipEngine(ProcessingEngine engine) {
-      MemoryStream memStream = new MemoryStream();
-      GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true);
-      PersistenceManager.Save(engine, stream);
-      stream.Close();
-      byte[] zippedEngine = memStream.ToArray();
-      memStream.Close();
-      return zippedEngine;
+      return PersistenceManager.SaveToGZip(engine);
     }
 
@@ -219,7 +215,5 @@
         }
         // restore the engine 
-        using(GZipStream stream = new GZipStream(new MemoryStream(zippedResult), CompressionMode.Decompress)) {
-          return (ProcessingEngine)PersistenceManager.Load(stream);
-        }
+        return (ProcessingEngine)PersistenceManager.RestoreFromGZip(zippedResult);
       }
     }
@@ -244,4 +238,5 @@
         }
       } while(retries < MAX_CONNECTION_RETRIES);
+      Trace.TraceWarning("Reached max connection retries in TryStartExecuteEngine");
       return Guid.Empty;
     }
@@ -264,4 +259,5 @@
         }
       } while(retries < MAX_CONNECTION_RETRIES);
+      Trace.TraceWarning("Reached max connection retries in TryEndExecuteEngine");
       return null;
     }
@@ -285,4 +281,5 @@
         }
       } while(retries < MAX_CONNECTION_RETRIES);
+      Trace.TraceWarning("Reached max connection retries in TryGetJobState");
       return JobState.Unknown;
     }
