[REEF-1542] Fix CoreCLR incompatibilities related to use of SystemException

This change replaces all uses of SystemException with custom ReefRuntimeException.

JIRA:
  [REEF-1542](https://issues.apache.org/jira/browse/REEF-1542)

Pull request:
  This closes #1112
diff --git a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
index e05335a..21839f8 100644
--- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
@@ -325,7 +325,7 @@
                 }
                 catch (Exception e)
                 {
-                    throw new SystemException("System error in starting Task.", e);
+                    throw new ReefRuntimeException("System error in starting Task.", e);
                 }
             }
         }
diff --git a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs
index 077ba31..0144573 100644
--- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs
@@ -22,6 +22,7 @@
 using Org.Apache.REEF.Common.Protobuf.ReefProtocol;
 using Org.Apache.REEF.Common.Runtime.Evaluator.Context;
 using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Exceptions;
 using Org.Apache.REEF.Utilities;
 using Org.Apache.REEF.Utilities.Diagnostics;
 using Org.Apache.REEF.Utilities.Logging;
@@ -215,11 +216,11 @@
                     const string msg = "RuntimeStopHandler invoked in state RUNNING.";
                     if (runtimeStop.Exception != null)
                     {
-                        OnException(new SystemException(msg, runtimeStop.Exception));
+                        OnException(new ReefRuntimeException(msg, runtimeStop.Exception));
                     }
                     else
                     {
-                        OnException(new SystemException(msg));
+                        OnException(new ReefRuntimeException(msg));
                     }
                 }
                 else
diff --git a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs
index b4f8374..c88e59c 100644
--- a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs
+++ b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs
@@ -17,7 +17,6 @@
 
 using System;
 using System.Collections.Generic;
-using System.Globalization;
 using Org.Apache.REEF.Common.Tasks;
 using Org.Apache.REEF.Network.Group.Config;
 using Org.Apache.REEF.Network.Group.Driver.Impl;
@@ -80,7 +79,7 @@
                     group.WaitingForRegistration();
                 }
             }
-            catch (SystemException e)
+            catch (ReefRuntimeException e)
             {
                 networkService.Unregister();
                 networkService.Dispose();
diff --git a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs
index 80b4dd3..202cfc4 100644
--- a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs
+++ b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs
@@ -392,7 +392,7 @@
 
                 var leftOver = string.Join(",", identifiers.Where(e => !foundList.Contains(e)));
                 Logger.Log(Level.Error, "For node {0}, cannot find registered parent/children: {1}.", _selfId, leftOver);
-                Exceptions.Throw(new SystemException("Failed to initialize operator topology for node: " + _selfId), Logger);
+                Exceptions.Throw(new ReefRuntimeException("Failed to initialize operator topology for node: " + _selfId), Logger);
             }
         }
     }
diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs
index ee4135f..018fb8f 100644
--- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs
+++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs
@@ -19,7 +19,7 @@
 
 namespace Org.Apache.REEF.Tang.Exceptions
 {
-    public class BindException : SystemException
+    public class BindException : ReefRuntimeException
     {
         internal BindException(string message)
             : base(message)
diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs
index b6ceb5e..9253949 100644
--- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs
+++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs
@@ -19,7 +19,7 @@
 
 namespace Org.Apache.REEF.Tang.Exceptions
 {
-    public sealed class ClassHierarchyException : SystemException
+    public sealed class ClassHierarchyException : ReefRuntimeException
     {
         internal ClassHierarchyException(string msg) : base(msg)
         {           
diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ReefRuntimeException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ReefRuntimeException.cs
new file mode 100644
index 0000000..abb7c14
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ReefRuntimeException.cs
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Org.Apache.REEF.Tang.Exceptions
+{
+    /// <summary>
+    /// A serializable exception that represents a general Reef error.
+    /// </summary>
+    [Serializable]
+    public class ReefRuntimeException : Exception
+    {
+        /// <summary>
+        /// Constructor. A serializable exception object that represents a general Reef error.
+        /// </summary>
+        public ReefRuntimeException(string message)
+            : base(message)
+        {
+        }
+
+        /// <summary>
+        /// Constructor. A serializable exception object that represents a general Reef error and wraps an inner exception
+        /// </summary>
+        /// <param name="message"></param>
+        /// <param name="innerException"></param>
+        public ReefRuntimeException(string message, Exception innerException)
+            : base(message, innerException)
+        {
+        }
+
+        public ReefRuntimeException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+        {
+        }
+    }
+}
diff --git a/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj b/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj
index 922e059..f0145ba 100644
--- a/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj
+++ b/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj
@@ -57,6 +57,7 @@
     <Compile Include="Exceptions\InjectionException.cs" />
     <Compile Include="Exceptions\NameResolutionException.cs" />
     <Compile Include="Exceptions\ParseException.cs" />
+    <Compile Include="Exceptions\ReefRuntimeException.cs" />
     <Compile Include="Exceptions\TangApplicationException.cs" />
     <Compile Include="Formats\AvroConfigurationDataContract\AvroConfiguration.cs" />
     <Compile Include="Formats\AvroConfigurationDataContract\ConfigurationEntry.cs" />
diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs
index 08816cb..0156bd0 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs
@@ -24,6 +24,7 @@
 using Org.Apache.REEF.IMRU.OnREEF.Driver;
 using Org.Apache.REEF.IMRU.OnREEF.IMRUTasks;
 using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Exceptions;
 using Org.Apache.REEF.Tang.Formats;
 using Org.Apache.REEF.Tang.Implementations.Configuration;
 using Org.Apache.REEF.Tang.Implementations.Tang;
@@ -185,7 +186,7 @@
                     }
 
                     Assert.Equal(InnerExceptionMessage, value.AsError().InnerException.Message);
-                    Assert.True(value.AsError().InnerException is System.SystemException);
+                    Assert.True(value.AsError().InnerException is ReefRuntimeException);
                 }
                 Logger.Log(Level.Info, ValidFailedTaskMessage);
                 value.GetActiveContext().Value.Dispose();
@@ -240,7 +241,7 @@
                     case TaskManager.TaskGroupCommunicationError:
                         throw new IMRUTaskGroupCommunicationException(_taskExceptionMessage);
                     default:
-                        throw new IMRUTaskSystemException(_taskExceptionMessage, new SystemException(InnerExceptionMessage));
+                        throw new IMRUTaskSystemException(_taskExceptionMessage, new ReefRuntimeException(InnerExceptionMessage));
                 }
             }
         }
diff --git a/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs b/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs
index dc5fd0a..5340b9f 100644
--- a/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs
+++ b/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs
@@ -20,6 +20,7 @@
 using System.Linq;
 using System.Threading;
 using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Exceptions;
 using Org.Apache.REEF.Tang.Implementations.InjectionPlan;
 using Org.Apache.REEF.Utilities;
 using Org.Apache.REEF.Utilities.Collections;
@@ -168,7 +169,7 @@
             }
             catch (Exception e)
             {
-                runtimeException = Optional<Exception>.Of(new SystemException("Caught Exception in clock, failing the Evaluator.", e));
+                runtimeException = Optional<Exception>.Of(new ReefRuntimeException("Caught Exception in clock, failing the Evaluator.", e));
             }
 
             var runtimeStop = runtimeException.IsPresent()