Skip to content

Need obvious way to check outright if a Transaction has been completed. #985

Closed

Description

@chriswebb

Had an issue where a fill on a NamedDataSet was failing with the following exception: System.InvalidOperationException: Inconvertible type mismatch between SourceColumn. This caused a rollback in either the NpgsqlDataAdapter or the DbDataAdapter without touching any of my code.

When my code tried rolling back the connection due to the exception, I was getting a: System.InvalidOperationException: This NpgsqlTransaction has completed; it is no longer usable.

Looking in the code, the only way to avoid a double rollback issue would be to check if the connection object is null on the transaction. This is non-obvious; so, I propose a property called IsCompleted be added to the transaction which performs this operation, and CheckCompleted() to be updated to use this new property.

I have made the changes and will be submitting a pull request and also added tests referencing this issue.

Activity

  1. roji commented on Mar 29, 2016

    @roji
    Member

    Merged into 3.0.6 and 3.1.

  2. roji commented on Apr 4, 2019

    @roji
    Member

    Note that I'm proposing removing the IsCompleted property for 4.1, as part of #2416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions