Skip to content

not supported for fields having DataTypeName 'text' #9

@peteglassey

Description

@peteglassey

Hi, we are running the ApacheAGE driver in a .net 9.0 (C#) application. When we upgrade the npgsql version in our application from 8.0.3 to any later version when running the following code

        while (await reader.ReadAsync())
        {
            string? nodeType = reader.GetValue<string?>(reader.GetOrdinal("nodeType"));
            Vertex? pNode = reader.GetValue<Agtype?>(reader.GetOrdinal("payee"))?.GetVertex();
            Vertex? pcNode = reader.GetValue<Agtype?>(reader.GetOrdinal("payeeConfigNode"))?.GetVertex();
            Vertex? cNode = reader.GetValue<Agtype?>(reader.GetOrdinal("Component"))?.GetVertex();

when we run the second statement in the code above reader.GetValue<Agtype?>(reader.GetOrdinal("payee"))?.GetVertex(); we get the following exception:

System.InvalidCastException: Reading as 'System.Nullable`1[[ApacheAGE.Types.Agtype, ApacheAGE, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' is not supported for fields having DataTypeName 'text'
   at Npgsql.Internal.AdoSerializerHelpers.<GetTypeInfoForReading>g__ThrowReadingNotSupported|0_0(Type type, PgSerializerOptions options, PgTypeId pgTypeId, Exception inner)
   at Npgsql.Internal.AdoSerializerHelpers.GetTypeInfoForReading(Type type, PgTypeId pgTypeId, PgSerializerOptions options)
   at Npgsql.BackendMessages.FieldDescription.<GetInfo>g__GetInfoSlow|50_0(Type type, ColumnInfo& lastColumnInfo)
   at Npgsql.BackendMessages.FieldDescription.GetInfo(Type type, ColumnInfo& lastColumnInfo)
   at Npgsql.NpgsqlDataReader.<GetInfo>g__Slow|133_0(ColumnInfo& info, PgConverter& converter, Size& bufferRequirement, Boolean& asObject, <>c__DisplayClass133_0&)
   at Npgsql.NpgsqlDataReader.GetFieldValueCore[T](Int32 ordinal)
   at Npgsql.NpgsqlDataReader.GetFieldValueAsync[T](Int32 ordinal, CancellationToken cancellationToken)
   at System.Data.Common.DbDataReader.GetFieldValueAsync[T](Int32 ordinal)
   at ApacheAGE.AgeDataReader.GetValue[T](Int32 ordinal)
   at Shared.Infrastructure.Repository.PayeeGraphRepository.GetGraphPayeeByIdAsync(String payeeId, CancellationToken cancellationToken) in XXXXXXXXXXXXXXXXXXX

We are running locally against apache/age docker image - which i believe is PG 16.

I have forked this repo and upgraded it to .net9 and upgraded its npgsl references to latest, and directly referenced the output DLL.

Im not sure if this is an issue with the apacheage driver (this repo) or actually in npgsql.

to note when we leave direct references to npgsql to the same version that is referenced by apacheage driver, then it works fine. Its just when they vary (direct vs the transient).

Any thoughts or ideas welcome.

Pete.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions