You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/12/25 15:47:02 UTC

[GitHub] [ignite] nizhikov commented on a change in pull request #8602: IGNITE-13734 .NET: Register service return type on method invocation

nizhikov commented on a change in pull request #8602:
URL: https://github.com/apache/ignite/pull/8602#discussion_r548886683



##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
##########
@@ -162,7 +168,34 @@ public BinaryType RegisterEnum(string typeName, IEnumerable<KeyValuePair<string,
         /// <returns>Type or null.</returns>
         public string GetTypeName(int id)
         {
-            return DoOutInOp((int) Op.GetType, w => w.WriteInt(id), r => Marshaller.StartUnmarshal(r).ReadString());
+            try
+            {
+                return DoOutInOp((int) Op.GetType, w =>

Review comment:
       Fixed.

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
##########
@@ -162,7 +168,34 @@ public BinaryType RegisterEnum(string typeName, IEnumerable<KeyValuePair<string,
         /// <returns>Type or null.</returns>
         public string GetTypeName(int id)
         {
-            return DoOutInOp((int) Op.GetType, w => w.WriteInt(id), r => Marshaller.StartUnmarshal(r).ReadString());
+            try
+            {
+                return DoOutInOp((int) Op.GetType, w =>
+                {
+                    w.WriteInt(id);
+                    w.WriteByte(DotNetPlatformId);
+                }, r => Marshaller.StartUnmarshal(r).ReadString());
+            }
+            catch (BinaryObjectException)
+            {
+                if (!Marshaller.RegisterSameJavaType.Value)
+                    throw;
+            }
+
+            // Try to get java type name and register corresponding DotNet type.
+            var javaTypeName = DoOutInOp((int) Op.GetType, w =>
+            {
+                w.WriteInt(id);
+                w.WriteByte(JavaPlatformId);
+            }, r => Marshaller.StartUnmarshal(r).ReadString());
+
+            RegisterType(id, Marshaller.GetTypeName(javaTypeName), false);
+
+            return DoOutInOp((int) Op.GetType, w =>

Review comment:
       Fixed.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org