Skip to content

4.1.0 not compatible with EF Core 2.2 #2655

Closed

Description

@pgrm

Hello, Npgsql 4.1.0 seems to have at least one breaking change compared to 4.0.10 which breaks the interaction with ef core 2.x:

https://github.com/npgsql/npgsql/blob/v4.1.0/src/Npgsql/NpgsqlStatement.cs#L36 was change from uint to ulong

I couldn't find in the release notes or on nuget, that npgsql isn't supposed to work with ef core 2.x the exception is, if it's used together with the NetTopologySuite. So is this breaking change by accident and could we get an updated Npgsql.EntityFrameworkCore.PostgreSQL for ef core 2.2?

If not, maybe it would be good to mention it in the release notes, as others might be inclined to update as well.

Thanks

Activity

  1. roji commented on Sep 26, 2019

    @roji
    Member

    I don't think the change you mentioned (uint to ulong) is related to any incompatibility with EF Core 2.2, cab you provide your reasons for thinking so (and ideally also a coffee sample and error)?

    The breaking changes notes for Npgsql 4.1 so mention that the NetTopoloySuite plugin is incompatible with previous versions; this is because NetTopologySuite itself has released a new major version (2.0.0) which EF Core 3.0.0 depends on.

  2. pgrm commented on Sep 27, 2019

    @pgrm
    Author

    @roji yes, that's why I thought it should be compatible and I updated, but when running our e2e test suite, I'm getting the following error:

    An error occurred while updating the entries. See the inner exception for details. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.MissingMethodException: Method not found: 'UInt32 Npgsql.NpgsqlStatement.get_Rows()'.
       at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
       at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple`2 parameters, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList`1 entriesToSave, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
    .....
    

    I can also try to make a repro code, but it seems to happen when we are trying to insert multiple items into a table at once.

  3. transferred this issue fromnpgsql/efcore.pgon Sep 30, 2019
  4. added this to the 4.1.1 milestone on Sep 30, 2019
  5. changed the title [-]Support for Npgsql 4.1 with ef core 2.2[/-] [+]4.1.0 not compatible with EF Core 2.2[/+] on Sep 30, 2019
  6. added theissue type on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions