Got an error caused by the BinaryFormatter upon deserialization of a large file.
This is the exception (which actually is missing a proper output, due to the bug in mono):
Parameter name: field Stack: at (wrapper managed-to-native) System.TypedReference.MakeTypedReferenceInternal(object,System.Reflection.FieldInfo[])
at System.TypedReference.MakeTypedReference (System.Object target, System.Reflection.FieldInfo[] flds) [0x00123] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.ObjectManager.DoValueTypeFixup (System.Reflection.FieldInfo memberToFix, System.Runtime.Serialization.ObjectHolder holder, System.Object value) [0x0014d] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.ObjectManager.CompleteObject (System.Runtime.Serialization.ObjectHolder holder, System.Boolean bObjectFullyComplete) [0x0021a] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups (System.Runtime.Serialization.ObjectHolder holder) [0x00040] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.ObjectManager.FixupSpecialObject (System.Runtime.Serialization.ObjectHolder holder) [0x000c0] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.ObjectManager.DoFixups () [0x0005a] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize (System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Runtime.Serialization.Formatters.Binary.__BinaryParser serParser, System.Boolean fCheck, System.Boolean isCrossAppDomain, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x00077] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck, System.Boolean isCrossAppDomain, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x000a2] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x00000] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck) [0x00000] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <599589bf4ce248909b8a14cbe4a2034e>:0
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <599589bf4ce248909b8a14cbe4a2034e>:0
This is an issue that was fixed in newer mono versions (BinaryFormatter deserialize fails with System.ArgumentException · Issue #13162 · mono/mono · GitHub | Using BinaryFormatter to deserialize an array in a struct in a parent class fails with unfriendly exception [reproducible test case i promise] · Issue #8915 · mono/mono · GitHub), but since Unity uses older fork, it never got fixed.
Please address this issue, and update Unity’s mono backend, or include the fix.