Unity version: 5.1.2f1
Win 7 standalone desktop deployment
We are trying to integrate a lesson data tracking system into our driving simulator application that tracks driver logins, driving violations, etc. We are using a remoting method where in Unity we obtain a proxy object via a TCP channel that is used to access remote functions on the server so we can pass information back and forth. The server merely reads/writes information to an XML file. The unique thing here is that we are passing DataTables which then get converted to xml on the server side.
I am aware that there are some serialization issues between Mono and .Net especially when using remoting proxies. The proxy dll was made using .Net 2.0 to stay compatible with Unity's mono version. The server is using .Net 4.0 or 4.5. Everything works great except when we pass a simple DataTable back to the server to record the driver's start lesson info. A google search yielded nothing useful. Our current Unity version is 5.1.2f1 running on a Win7 box - deploying standalone desktop app. I know this is a specific use case but any help would be appreciated.
Here is the offending function code snippet:
public int StartLesson(int lessonID)
{
int returnCode;
if (m_DriverID == new Guid())
{
returnCode = 2; // No driver has logged in.
}
else
{
m_lessonID = lessonID;
NodeDataset.MST_LESSONRow[] myLesson = (NodeDataset.MST_LESSONRow[]) m_NodeHostManager.GetLesson(m_lessonID).Select();
NodeDataset.TRN_DRIVERLESSONSRow[] myDriverLessons = (NodeDataset.TRN_DRIVERLESSONSRow[]) m_NodeHostManager.GetDriverLessons().Select("LESSON_ID = " + m_lessonID.ToString());
if (myDriverLessons.Length == 0)
{
returnCode = 1; // The stated lesson is not registered for the logged driver.
}
else
{
// Check if pre-req is required.
if (myLesson[0].IsNull("PREREQ_ID"))
{
returnCode = 0; // All good to go.
}
else
{
// Checked if pre-req is complete.
NodeDataset.MST_LESSONRow[] myPreReq = (NodeDataset.MST_LESSONRow[]) m_NodeHostManager.GetLesson(myLesson[0].LESSON_ID).Select();
if (myPreReq[0].IS_COMPLETE)
{
returnCode = 0; // All good to go.
}
else
{
returnCode = 3; //Pre-req is incomplete or failed.
}
}
//Everything checked. Ready to start lesson.
if (returnCode == 0)
{
// Prep for the results.
NodeDataset.TRN_RESULTDataTable myResult = m_NodeHostManager.GetResults();
//myResult.WriteXml( @"C:\Users\VDI\AppData\Roaming\VDI\VDE\Result.xml" );
m_ResultID = Guid.NewGuid();
m_DriverLessonID = myDriverLessons[0].DRIVERLESSON_ID;
m_MaximumScore = myLesson[0].TOTAL_SCORE;
m_PassingScore = myLesson[0].PASS_SCORE;
m_TotalInfringements = 0;
// Stage the result for recording.
NodeDataset.TRN_RESULTRow myNewResult = myResult.NewTRN_RESULTRow();
myNewResult.RESULT_ID = m_ResultID;
myNewResult.DRIVERLESSON_ID = m_DriverLessonID;
myNewResult.START_DATE = DateTime.Now;
myNewResult.END_DATE = DateTime.Now;
myNewResult.IS_COMPLETE = false;
myNewResult.SCORE = 0;
myNewResult.IS_FAIL = false;
myNewResult.NODE_ID = m_NodeHostManager.NodeID;
myResult.AddTRN_RESULTRow(myNewResult);
//myResult.WriteXml( @"C:\Users\VDI\AppData\Roaming\VDI\VDE\Result.xml" );
//myResult.RemotingFormat = SerializationFormat.Binary;
try
{
**
//THIS LINE THROWS THE SERIALIZATION EXCEPTION
m_NodeHostManager.SetResult(myResult);
**
}
catch(Exception e)
{
Debug.Log( "MESSAGE =============================");
Debug.LogError(e.Message);
Debug.Log( "BASE =============================" );
Debug.LogError( e.GetBaseException().ToString() );
Debug.Log( "DATA =============================" );
Debug.LogError(e.StackTrace);
Debug.Log( "SOURCE =============================" );
Debug.Log( e.Source );
}
}
}
}
return returnCode;
}
We get these errors from a try/catch
MESSAGE:
Exception has been thrown by the target of an invocation.
UnityEngine.Debug:LogError(Object)
SIMNode.VisionNodeClass:StartLesson(Int32) (at Assets/SIMnode/VisionNodeClass.cs:608)
DataManager:createLessonAttempt() (at Assets/VDI/Managers/DataManager.cs:1626)
DataManager:Awake() (at Assets/VDI/Managers/DataManager.cs:255)
BASE:
System.Runtime.Serialization.SerializationException: No element named hasLineInfo could be found.
at System.Runtime.Serialization.SerializationInfo.GetValue (System.String name, System.Type type) [0x00033] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs:144
at System.Runtime.Serialization.SerializationInfo.GetBoolean (System.String name) [0x00000] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs:252
at System.Xml.Schema.XmlSchemaException..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext context) [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00119] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:513
UnityEngine.Debug:LogError(Object)
SIMNode.VisionNodeClass:StartLesson(Int32) (at Assets/SIMnode/VisionNodeClass.cs:610)
DataManager:createLessonAttempt() (at Assets/VDI/Managers/DataManager.cs:1626)
DataManager:Awake() (at Assets/VDI/Managers/DataManager.cs:255)
DATA:
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0012c] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:519
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115
at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingContext context) [0x000d7] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs:578
at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00066] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs:84
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x0000f] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:145
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x0003f] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:110
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00007] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:95
at System.Runtime.Serialization.Formatters.Binary.MessageFormatter.ReadMethodResponse (BinaryElement elem, System.IO.BinaryReader reader, Boolean hasHeaders, System.Runtime.Remoting.Messaging.HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter) [0x000f8] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs:437
at System.Runtime.Serialization.Formatters.Binary.MessageFormatter.ReadMethodResponse (System.IO.BinaryReader reader, Boolean hasHeaders, System.Runtime.Remoting.Messaging.HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter) [0x00007] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs:390
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserializeMethodResponse (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, IMethodCallMessage methodCallMessage) [0x00042] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:206
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.DeserializeMethodResponse (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, IMethodCallMessage methodCallMessage) [0x00000] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:188
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage (IMessage msg) [0x00000] in :0
UnityEngine.Debug:LogError(Object)
SIMNode.VisionNodeClass:StartLesson(Int32) (at Assets/SIMnode/VisionNodeClass.cs:612)
DataManager:createLessonAttempt() (at Assets/VDI/Managers/DataManager.cs:1626)
DataManager:Awake() (at Assets/VDI/Managers/DataManager.cs:255)
SOURCE:
mscorlib
UnityEngine.Debug:Log(Object)
SIMNode.VisionNodeClass:StartLesson(Int32) (at Assets/SIMnode/VisionNodeClass.cs:614)
DataManager:createLessonAttempt() (at Assets/VDI/Managers/DataManager.cs:1626)
DataManager:Awake() (at Assets/VDI/Managers/DataManager.cs:255)
↧