[
https://issues.apache.org/jira/browse/IGNITE-13734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17249777#comment-17249777
]
Pavel Tupitsyn commented on IGNITE-13734:
-----------------------------------------
[~YAMolochkov] the problem here is similar to what we fixed on Java side in
IGNITE-12823. Losing array type information is caused by limitations of Ignite
binary format.
Replacing returned array with reflection is what we do on Java side, see
{{PlatformServices#convertArrayArgs}}. This is an easier approach, and I think
the performance hit would not be very noticeable compared to the overall
service call cost.
Alternatively, we can implement a more efficient but slightly more complex
approach:
* Pass expected result type to {{ServiceProxySerializer.ReadInvocationResult}}
* Add non-generic {{BinaryReader.ReadArray}} overload that takes element type
and uses {{Array.CreateInstance}}
> .NET Service loses returned array type information
> --------------------------------------------------
>
> Key: IGNITE-13734
> URL: https://issues.apache.org/jira/browse/IGNITE-13734
> Project: Ignite
> Issue Type: Bug
> Components: platforms
> Affects Versions: 2.9
> Reporter: Alexey Kukushkin
> Assignee: Nikolai Kulagin
> Priority: Major
>
> .NET service client receives Object[] instead of strongly typed array from a
> .NET service.
> There was another already resolved similar issue IGNITE-12823 that addressed
> the problem of using arrays as parameters. The problem of using arrays as
> results still exists.
> h3. Reproducer
> A .NET service returning an array of user-defined types is deployed:
> {code:c#}
> public interface ITestService
> {
> Parameter[] TestReturnParametersArray();
> }
> public sealed class Parameter
> {
> public int Id { get; set; }
> public int[] Values { get; set; }
> }
> {code}
> A .NET client calls the service:
> {code:c#}
> Parameter[] res = svcProxy.TestReturnParametersArray()
> {code}
> The service call fails with exception:
> {code}
> System.InvalidCastException : Unable to cast object of type 'System.Object[]'
> to type 'Parameter[]'.
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)