You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (Jira)" <ji...@apache.org> on 2021/01/29 08:59:00 UTC
[jira] [Updated] (IGNITE-13639) .NET: Type cast exception on
cache.Get with an array of empty Lists
[ https://issues.apache.org/jira/browse/IGNITE-13639?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Tupitsyn updated IGNITE-13639:
------------------------------------
Summary: .NET: Type cast exception on cache.Get with an array of empty Lists (was: .NET: No coercion operator is defined between types 'System.Int32' and 'swagger.Models.IndexParameter[]'.)
> .NET: Type cast exception on cache.Get with an array of empty Lists
> -------------------------------------------------------------------
>
> Key: IGNITE-13639
> URL: https://issues.apache.org/jira/browse/IGNITE-13639
> Project: Ignite
> Issue Type: Bug
> Components: platforms
> Affects Versions: 2.9
> Environment: Apache Ignite: v2.9.0
> JDK: v1.8
> .NET Core: v3.1
> Reporter: Danut Radoaica
> Assignee: Pavel Tupitsyn
> Priority: Critical
> Labels: .NET, 2.9.1-rc
> Fix For: 2.11
>
> Attachments: BotXEntityDto.cs, ConsoleApp1.zip, exception.txt, stream_dump.txt
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> [^exception.txt] contains the stack trace
> [^stream_dump.txt] contains the stream that fails, dumped using System.Text.Encoding.UTF8.GetString
> [^BotXEntityDto.cs] contains the dto definition
> Minimal reproducer:
> {code}
> using System.Collections.Generic;
> using Apache.Ignite.Core;
> var ignite = Ignition.Start();
> var cache = ignite.GetOrCreateCache<int, Entity[]>("c");
> cache.Put(1, new[]
> {
> new Entity {Inner = new List<object>()},
> new Entity {Inner = new List<object>()}
> });
> cache.Get(1);
> class Entity
> {
> public IList<object> Inner { get; set; }
> }
> {code}
> Works on 2.8.0, fails on 2.9.1.
> The problem is that IGNITE-12827 has changed the detach semantics for arrays and collections, and this revealed the problem on .NET side: array and collection elements can share handles (same object references), which is a problem, because Java handles every element separately. And the bug occurs because an empty list has {{_items}} initialized to a shared empty array instance.
> *Workaround*: use {{List<Entity>}} instead of {{Entity[]}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)