in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Get "cannot rollback - no transaction active" when trying to use a context on which there was a failure

Last post 06-26-2009 9:39 PM by Robert Simpson. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-25-2009 11:45 AM

    • pwab
    • Not Ranked
    • Joined on 06-25-2009
    • Posts 2

    Get "cannot rollback - no transaction active" when trying to use a context on which there was a failure

    Hi,

    First off: Thanks for doing this and making it available for free. I appreciate it.

    I get a failure when I try to execute context.SaveChanges() (using Entity Framework)

    A little bit of background:

    1. I create a database
    2. connect to it via entity framework and sqlite ado.net provider.
    3. I cause a failure via a trigger (to work around the foreign key constraints issue)
    4. then try to execute an operation that would otherwise succeed (in this case, creating a new entity)

    This is the failure:

    Test method Tests.PrioritiesTests.PriorityBadProjectTest threw exception: System.Data.SQLite.SQLiteException: SQLite error cannot rollback - no transaction is active.

    Here is the stack trace:

    System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
    System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
    System.Data.SQLite.SQLiteDataReader.NextResult()
    System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
    System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
    System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
    System.Data.SQLite.SQLiteTransaction.IssueRollback(SQLiteConnection cnn)
    System.Data.SQLite.SQLiteTransaction.Rollback()
    System.Data.SQLite.SQLiteTransaction.Dispose(Boolean disposing)
    System.Data.Common.DbTransaction.Dispose()
    System.Data.EntityClient.EntityTransaction.Dispose(Boolean disposing)
    System.Data.Common.DbTransaction.Dispose()
    System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)
    System.Data.Objects.ObjectContext.SaveChanges()
    ...
  • 06-25-2009 6:49 PM In reply to

    Re: Get "cannot rollback - no transaction active" when trying to use a context on which there was a failure

    Bleh.  I think I have a way to fix this in the next release without causing too much headache for existing code and behaviors.

     

  • 06-26-2009 12:05 AM In reply to

    • pwab
    • Not Ranked
    • Joined on 06-25-2009
    • Posts 2

    Re: Get "cannot rollback - no transaction active" when trying to use a context on which there was a failure

    That's great, thanks! Two questions though:

    1. Can you think of a work-around for me? A way of 'resetting' the connection?
    2. When you think the next release will be available?
  • 06-26-2009 9:39 PM In reply to

    Re: Get "cannot rollback - no transaction active" when trying to use a context on which there was a failure

    There's no workaround that I know of, other than to wait for the patch.

    The next release is slated for the end of next week, just after SQLite 3.6.16 is scheduled for release.

     

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems