diff --git a/src/csharp/Microsoft.Spark/Interop/Ipc/JvmObjectReference.cs b/src/csharp/Microsoft.Spark/Interop/Ipc/JvmObjectReference.cs
index be19cce3d..3527b2fb2 100644
--- a/src/csharp/Microsoft.Spark/Interop/Ipc/JvmObjectReference.cs
+++ b/src/csharp/Microsoft.Spark/Interop/Ipc/JvmObjectReference.cs
@@ -149,6 +149,7 @@ internal JvmObjectReference(JvmObjectReference other)
///
/// An unique identifier for an object created on the JVM.
///
+ ///
internal JvmObjectId Id { get; }
///
diff --git a/src/csharp/Microsoft.Spark/SparkContext.cs b/src/csharp/Microsoft.Spark/SparkContext.cs
index f911517ef..6f8357290 100644
--- a/src/csharp/Microsoft.Spark/SparkContext.cs
+++ b/src/csharp/Microsoft.Spark/SparkContext.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
@@ -22,6 +23,7 @@ public sealed class SparkContext : IJvmObjectReferenceProvider
{
private readonly JvmObjectReference _jvmObject;
+ [NonSerialized]
private readonly SparkConf _conf;
///
diff --git a/src/csharp/Microsoft.Spark/Sql/Catalog/Catalog.cs b/src/csharp/Microsoft.Spark/Sql/Catalog/Catalog.cs
index 2175ddb07..6aa17313c 100644
--- a/src/csharp/Microsoft.Spark/Sql/Catalog/Catalog.cs
+++ b/src/csharp/Microsoft.Spark/Sql/Catalog/Catalog.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System;
using Microsoft.Spark.Interop.Ipc;
namespace Microsoft.Spark.Sql.Catalog
diff --git a/src/csharp/Microsoft.Spark/Sql/SparkSession.cs b/src/csharp/Microsoft.Spark/Sql/SparkSession.cs
index fc706081f..0c96e7a08 100644
--- a/src/csharp/Microsoft.Spark/Sql/SparkSession.cs
+++ b/src/csharp/Microsoft.Spark/Sql/SparkSession.cs
@@ -17,11 +17,15 @@ namespace Microsoft.Spark.Sql
///
/// The entry point to programming Spark with the Dataset and DataFrame API.
///
+ [Serializable]
public sealed class SparkSession : IDisposable, IJvmObjectReferenceProvider
{
+ [NonSerialized]
private readonly JvmObjectReference _jvmObject;
+ [NonSerialized]
private readonly Lazy _sparkContext;
+ [NonSerialized]
private readonly Lazy _catalog;
private static readonly string s_sparkSessionClassName =