Open Closed

Regarding Unit test issue #1929


User avatar
0
ChetanKumbhar created

Hi, I am trying to run Unit test cases, but i am getting following error.

Message: System.InvalidOperationException : SqliteConnection does not support nested transactions.

Stack Trace: SqliteConnection.BeginTransaction(IsolationLevel isolationLevel, Boolean deferred) SqliteConnection.BeginTransaction(IsolationLevel isolationLevel) SqliteConnection.BeginDbTransaction(IsolationLevel isolationLevel) DbConnection.BeginTransaction(IsolationLevel isolationLevel) RelationalConnection.BeginTransaction(IsolationLevel isolationLevel) RelationalConnection.BeginTransaction() DatabaseFacade.BeginTransaction() UnitOfWorkDbContextProvider1.CreateDbContextWithTransaction(IUnitOfWork unitOfWork) UnitOfWorkDbContextProvider1.CreateDbContext(IUnitOfWork unitOfWork) UnitOfWorkDbContextProvider1.CreateDbContext(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) <44 more frames...> CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) <<GetInvoiceByStatusAsync>b__0>d.MoveNext() line 256 --- End of stack trace from previous location --- InvoiceManagementTestBase1.WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func1 action) line 33 InvoiceApplicationTests.GetInvoiceByStatusAsync() line 254 --- End of stack trace from previous location ---~~~~

what i am missing?

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    SqliteConnection does not support nested transactions.

    You can disable the transaction in unit test, This is a limitation of sqlite, we can only do this.

    Configure<AbpUnitOfWorkDefaultOptions>(options =>
    {
        options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
    });
    
  • User Avatar
    0
    ChetanKumbhar created

    @maliming,

    I tried with this, but yet issue not fixed.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 19, 2024, 12:56