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 2017/08/03 18:37:00 UTC

[jira] [Commented] (IGNITE-5927) .NET: DataTable can't be serialized

    [ https://issues.apache.org/jira/browse/IGNITE-5927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16113262#comment-16113262 ] 

Pavel Tupitsyn commented on IGNITE-5927:
----------------------------------------

I've reproduced the issue, and I would say that this is a bug in {{System.Data.DataTable}}. Here is the code:

{code}
public virtual void GetObjectData(SerializationInfo info, StreamingContext context) {
    SerializationFormat remotingFormat = RemotingFormat;
    bool isSingleTable = context.Context != null ? Convert.ToBoolean(context.Context, CultureInfo.InvariantCulture) : true;
    SerializeDataTable(info, context, isSingleTable, remotingFormat);
}
{code}

Exception comes from {{Convert.ToBoolean(context.Context, CultureInfo.InvariantCulture)}}

The assumption that {{Context}} can be converted to bool does not look correct, see MSDN https://msdn.microsoft.com/en-us/library/h58hxyt6(v=vs.110).aspx:

{code}additional: Any additional information to be associated with the StreamingContext.{code}

Anyway, .NET framework is not going to be fixed, so we have to get rid of {{BinaryWriter}} in that context. 

> .NET: DataTable can't be serialized
> -----------------------------------
>
>                 Key: IGNITE-5927
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5927
>             Project: Ignite
>          Issue Type: Bug
>          Components: platforms
>    Affects Versions: 2.0
>            Reporter: Pavel Tupitsyn
>            Assignee: Pavel Tupitsyn
>              Labels: .NET
>             Fix For: 2.2
>
>
> {{System.Data.DataTable}} can't be serialized:
> {code}
> cache.Put(1, new DataTable());
> {code}
> results in exception:
> {code}
> System.InvalidCastException: Unable to cast object of type 'Apache.Ignite.Core.Impl.Binary.BinaryWriter' to type 'System.IConvertible'.
>    at System.Convert.ToBoolean(Object value, IFormatProvider provider)
>    at System.Data.DataTable.GetObjectData(SerializationInfo info, StreamingContext context)
>    at Apache.Ignite.Core.Impl.Binary.SerializableSerializer.WriteBinary[T](T obj, BinaryWriter writer) in S:\W\incubator-ignite\modules\platforms\dotnet\Apache.Ignite.Core\Impl\Binary\SerializableSerializer.cs:line 64
>    at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj) in S:\W\incubator-ignite\modules\platforms\dotnet\Apache.Ignite.Core\Impl\Binary\BinaryWriter.cs:line 1224
>    at Apache.Ignite.Core.Impl.Binary.Marshaller.Marshal[T](T val, IBinaryStream stream) in S:\W\incubator-ignite\modules\platforms\dotnet\Apache.Ignite.Core\Impl\Binary\Marshaller.cs:line 159
>    at Apache.Ignite.Core.Impl.Binary.Marshaller.Marshal[T](T val) in S:\W\incubator-ignite\modules\platforms\dotnet\Apache.Ignite.Core\Impl\Binary\Marshaller.cs:line 144
> {code}
> StackOverflow question: https://stackoverflow.com/questions/45490249/how-to-store-datatable-in-apache-ignite



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)