ptupitsyn commented on code in PR #10214:
URL: https://github.com/apache/ignite/pull/10214#discussion_r954047932


##########
modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs:
##########
@@ -603,13 +597,33 @@ private static object ReadAsCustomType(Type customType, 
SerializationInfo serInf
         {
             var ctorFunc = 
SerializableTypeDescriptor.Get(customType).SerializationCtor;
 
-            var customObj = ctorFunc(serInfo, ctx);
+            var customObj = ctorFunc != null
+                ? ctorFunc(serInfo, ctx)
+                : FormatterServices.GetUninitializedObject(customType);
 
             var wrapper = customObj as IObjectReference;
 
-            return wrapper == null
+            var resObj = wrapper == null
                 ? customObj
                 : wrapper.GetRealObject(ctx);
+
+            // Special case: type is replaced, but there is no serialization 
ctor.
+            // Example: StringComparer.OrdinalIgnoreCase.
+            if (ctorFunc == null)
+            {
+                // Cached internally.
+                var members = 
FormatterServices.GetSerializableMembers(resObj.GetType());

Review Comment:
   `SerializableSerializer` handles `ISerializable` types only. If a member of 
such type is marked with `[NonSerialized]`, it is skipped during serialization. 
This is what `GetSerializableMembers` does - returns all members that do not 
have `[NonSerialized]` attribute.
   
   We are just following the same logic as the built-in binary serializer has.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to