Fix diff-serialization and deserialization of C# lists

#347
This commit is contained in:
Wojtek Figat
2021-04-20 16:06:32 +02:00
parent 9857fb12c4
commit 28c0552e0a
8 changed files with 158 additions and 19 deletions

View File

@@ -46,10 +46,7 @@ namespace FlaxEditor.CustomEditors
if (values.HasReferenceValue)
{
var v = (IList)values.ReferenceValue;
// Get the reference value if collections are the same size
if (v != null && values.Count == v.Count)
if (values.ReferenceValue is IList v && values.Count == v.Count && v.Count > index)
{
_referenceValue = v[index];
_hasReferenceValue = true;

View File

@@ -326,6 +326,24 @@ bool MAssembly::LoadWithImage(const String& assemblyPath)
mono_debug_open_image_from_memory(assemblyImage, _debugData.Get(), _debugData.Count());
}
}
#if 0
// Hack to load debug information for Newtonsoft.Json (enable it to debug C# code of json lib)
if (assemblyPath.EndsWith(TEXT("FlaxEngine.CSharp.dll")))
{
static Array<byte> NewtonsoftJsonDebugData;
File::ReadAllBytes(StringUtils::GetDirectoryName(assemblyPath) / TEXT("Newtonsoft.Json.pdb"), NewtonsoftJsonDebugData);
if (NewtonsoftJsonDebugData.HasItems())
{
StringAnsi tmp(StringUtils::GetDirectoryName(assemblyPath) / TEXT("Newtonsoft.Json.dll"));
MonoAssembly* a = mono_assembly_open(tmp.Get(), &status);
if (a)
{
mono_debug_open_image_from_memory(mono_assembly_get_image(a), NewtonsoftJsonDebugData.Get(), NewtonsoftJsonDebugData.Count());
}
}
}
#endif
#endif
// Set state

Binary file not shown.

Binary file not shown.

View File

@@ -1865,6 +1865,15 @@
<param name="message">The error message that explains the reason for the exception.</param>
<param name="innerException">The exception that is the cause of the current exception, or <c>null</c> if no inner exception is specified.</param>
</member>
<member name="M:Newtonsoft.Json.JsonException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.JsonException"/> class.
</summary>
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
<exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
<exception cref="T:System.Runtime.Serialization.SerializationException">The class name is <c>null</c> or <see cref="P:System.Exception.HResult"/> is zero (0).</exception>
</member>
<member name="T:Newtonsoft.Json.JsonExtensionDataAttribute">
<summary>
Instructs the <see cref="T:Newtonsoft.Json.JsonSerializer"/> to deserialize properties with no matching class member into the specified collection
@@ -2471,6 +2480,15 @@
<param name="message">The error message that explains the reason for the exception.</param>
<param name="innerException">The exception that is the cause of the current exception, or <c>null</c> if no inner exception is specified.</param>
</member>
<member name="M:Newtonsoft.Json.JsonReaderException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.JsonReaderException"/> class.
</summary>
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
<exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
<exception cref="T:System.Runtime.Serialization.SerializationException">The class name is <c>null</c> or <see cref="P:System.Exception.HResult"/> is zero (0).</exception>
</member>
<member name="M:Newtonsoft.Json.JsonReaderException.#ctor(System.String,System.String,System.Int32,System.Int32,System.Exception)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.JsonReaderException"/> class
@@ -2512,6 +2530,15 @@
<param name="message">The error message that explains the reason for the exception.</param>
<param name="innerException">The exception that is the cause of the current exception, or <c>null</c> if no inner exception is specified.</param>
</member>
<member name="M:Newtonsoft.Json.JsonSerializationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.JsonSerializationException"/> class.
</summary>
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
<exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
<exception cref="T:System.Runtime.Serialization.SerializationException">The class name is <c>null</c> or <see cref="P:System.Exception.HResult"/> is zero (0).</exception>
</member>
<member name="T:Newtonsoft.Json.JsonSerializer">
<summary>
Serializes and deserializes objects into and from the JSON format.
@@ -2553,7 +2580,7 @@
<member name="P:Newtonsoft.Json.JsonSerializer.TypeNameAssemblyFormatHandling">
<summary>
Gets or sets how a type name assembly is written and resolved by the serializer.
The default value is <see cref="!:FormatterAssemblyStyle.Simple" />.
The default value is <see cref="F:System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple" />.
</summary>
<value>The type name assembly format.</value>
</member>
@@ -2620,6 +2647,12 @@
serializing .NET objects to JSON and vice versa.
</summary>
</member>
<member name="P:Newtonsoft.Json.JsonSerializer.Context">
<summary>
Gets or sets the <see cref="T:System.Runtime.Serialization.StreamingContext"/> used by the serializer when invoking serialization callback methods.
</summary>
<value>The context.</value>
</member>
<member name="P:Newtonsoft.Json.JsonSerializer.Formatting">
<summary>
Indicates how JSON text output is formatted.
@@ -3003,6 +3036,12 @@
</summary>
<value>The error handler called during serialization and deserialization.</value>
</member>
<member name="P:Newtonsoft.Json.JsonSerializerSettings.Context">
<summary>
Gets or sets the <see cref="T:System.Runtime.Serialization.StreamingContext"/> used by the serializer when invoking serialization callback methods.
</summary>
<value>The context.</value>
</member>
<member name="P:Newtonsoft.Json.JsonSerializerSettings.DateFormatString">
<summary>
Gets or sets how <see cref="T:System.DateTime"/> and <see cref="T:System.DateTimeOffset"/> values are formatted when writing JSON text,
@@ -5479,6 +5518,15 @@
<param name="message">The error message that explains the reason for the exception.</param>
<param name="innerException">The exception that is the cause of the current exception, or <c>null</c> if no inner exception is specified.</param>
</member>
<member name="M:Newtonsoft.Json.JsonWriterException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.JsonWriterException"/> class.
</summary>
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
<exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
<exception cref="T:System.Runtime.Serialization.SerializationException">The class name is <c>null</c> or <see cref="P:System.Exception.HResult"/> is zero (0).</exception>
</member>
<member name="M:Newtonsoft.Json.JsonWriterException.#ctor(System.String,System.String,System.Exception)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.JsonWriterException"/> class
@@ -8898,6 +8946,15 @@
<param name="message">The error message that explains the reason for the exception.</param>
<param name="innerException">The exception that is the cause of the current exception, or <c>null</c> if no inner exception is specified.</param>
</member>
<member name="M:Newtonsoft.Json.Schema.JsonSchemaException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Schema.JsonSchemaException"/> class.
</summary>
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
<exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
<exception cref="T:System.Runtime.Serialization.SerializationException">The class name is <c>null</c> or <see cref="P:System.Exception.HResult"/> is zero (0).</exception>
</member>
<member name="T:Newtonsoft.Json.Schema.JsonSchemaGenerator">
<summary>
<para>
@@ -9188,10 +9245,10 @@
</member>
<member name="P:Newtonsoft.Json.Serialization.DefaultContractResolver.IgnoreSerializableInterface">
<summary>
Gets or sets a value indicating whether to ignore the <see cref="!:ISerializable"/> interface when serializing and deserializing types.
Gets or sets a value indicating whether to ignore the <see cref="T:System.Runtime.Serialization.ISerializable"/> interface when serializing and deserializing types.
</summary>
<value>
<c>true</c> if the <see cref="!:ISerializable"/> interface will be ignored when serializing and deserializing types; otherwise, <c>false</c>.
<c>true</c> if the <see cref="T:System.Runtime.Serialization.ISerializable"/> interface will be ignored when serializing and deserializing types; otherwise, <c>false</c>.
</value>
</member>
<member name="P:Newtonsoft.Json.Serialization.DefaultContractResolver.IgnoreSerializableAttribute">
@@ -9301,6 +9358,13 @@
<param name="objectType">Type of the object.</param>
<returns>A <see cref="T:Newtonsoft.Json.Serialization.JsonLinqContract"/> for the given type.</returns>
</member>
<member name="M:Newtonsoft.Json.Serialization.DefaultContractResolver.CreateISerializableContract(System.Type)">
<summary>
Creates a <see cref="T:Newtonsoft.Json.Serialization.JsonISerializableContract"/> for the given type.
</summary>
<param name="objectType">Type of the object.</param>
<returns>A <see cref="T:Newtonsoft.Json.Serialization.JsonISerializableContract"/> for the given type.</returns>
</member>
<member name="M:Newtonsoft.Json.Serialization.DefaultContractResolver.CreateDynamicContract(System.Type)">
<summary>
Creates a <see cref="T:Newtonsoft.Json.Serialization.JsonDynamicContract"/> for the given type.
@@ -9707,6 +9771,21 @@
</summary>
<param name="underlyingType">The underlying type for the contract.</param>
</member>
<member name="T:Newtonsoft.Json.Serialization.SerializationCallback">
<summary>
Handles <see cref="T:Newtonsoft.Json.JsonSerializer"/> serialization callback events.
</summary>
<param name="o">The object that raised the callback event.</param>
<param name="context">The streaming context.</param>
</member>
<member name="T:Newtonsoft.Json.Serialization.SerializationErrorCallback">
<summary>
Handles <see cref="T:Newtonsoft.Json.JsonSerializer"/> serialization error callback events.
</summary>
<param name="o">The object that raised the callback event.</param>
<param name="context">The streaming context.</param>
<param name="errorContext">The error context.</param>
</member>
<member name="T:Newtonsoft.Json.Serialization.ExtensionDataSetter">
<summary>
Sets extension data for an object during deserialization.
@@ -9750,6 +9829,36 @@
</summary>
<value>The converter.</value>
</member>
<member name="P:Newtonsoft.Json.Serialization.JsonContract.OnDeserializedCallbacks">
<summary>
Gets or sets all methods called immediately after deserialization of the object.
</summary>
<value>The methods called immediately after deserialization of the object.</value>
</member>
<member name="P:Newtonsoft.Json.Serialization.JsonContract.OnDeserializingCallbacks">
<summary>
Gets or sets all methods called during deserialization of the object.
</summary>
<value>The methods called during deserialization of the object.</value>
</member>
<member name="P:Newtonsoft.Json.Serialization.JsonContract.OnSerializedCallbacks">
<summary>
Gets or sets all methods called after serialization of the object graph.
</summary>
<value>The methods called after serialization of the object graph.</value>
</member>
<member name="P:Newtonsoft.Json.Serialization.JsonContract.OnSerializingCallbacks">
<summary>
Gets or sets all methods called before serialization of the object.
</summary>
<value>The methods called before serialization of the object.</value>
</member>
<member name="P:Newtonsoft.Json.Serialization.JsonContract.OnErrorCallbacks">
<summary>
Gets or sets all method called when an error is thrown during the serialization of the object.
</summary>
<value>The methods called when an error is thrown during the serialization of the object.</value>
</member>
<member name="P:Newtonsoft.Json.Serialization.JsonContract.DefaultCreator">
<summary>
Gets or sets the default creator method used to create the object.
@@ -9826,6 +9935,23 @@
</summary>
<param name="underlyingType">The underlying type for the contract.</param>
</member>
<member name="T:Newtonsoft.Json.Serialization.JsonISerializableContract">
<summary>
Contract details for a <see cref="T:System.Type"/> used by the <see cref="T:Newtonsoft.Json.JsonSerializer"/>.
</summary>
</member>
<member name="P:Newtonsoft.Json.Serialization.JsonISerializableContract.ISerializableCreator">
<summary>
Gets or sets the <see cref="T:System.Runtime.Serialization.ISerializable"/> object constructor.
</summary>
<value>The <see cref="T:System.Runtime.Serialization.ISerializable"/> object constructor.</value>
</member>
<member name="M:Newtonsoft.Json.Serialization.JsonISerializableContract.#ctor(System.Type)">
<summary>
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Serialization.JsonISerializableContract"/> class.
</summary>
<param name="underlyingType">The underlying type for the contract.</param>
</member>
<member name="T:Newtonsoft.Json.Serialization.JsonLinqContract">
<summary>
Contract details for a <see cref="T:System.Type"/> used by the <see cref="T:Newtonsoft.Json.JsonSerializer"/>.

Binary file not shown.

Binary file not shown.

View File

@@ -82,10 +82,8 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.PS4:
case TargetPlatform.XboxScarlett:
{
foreach (var file in outputFileNames)
{
Utilities.FileCopy(Path.Combine(binFolder, file), Path.Combine(options.PlatformsFolder, platform.ToString(), file));
}
var file = "Newtonsoft.Json.dll";
Utilities.FileCopy(Path.Combine(binFolder, file), Path.Combine(options.PlatformsFolder, platform.ToString(), "Binaries", file));
break;
}
}