invispix 10x10
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IT38810 Status: Closed

SYSTEM.ARGUMENTEXCEPTION OCCURS WHILE PERFORMING DML OPERATION ON LARGE
BATCH STATEMENTS VIA EF CORE

product:
DB2 CONNECT / DB2CONNCT / B50 - DB2
Problem description:
When Application performs DML operation on a Large batch of
statements using IBM Entity Framework Core driver, following
error can occur:

System.ArgumentException: An item with the same key has already
been added. Key: p98
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key,
TValue value, InsertionBehavior behavior)
at
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBa
tch.CreateStoreCommand()
at
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBa
tch.ExecuteAsync(IRelationalConnection connection,
CancellationToken cancellationToken)
at
IBM.EntityFrameworkCore.Update.Internal.Db2BatchExecutor.Execute
Async(IEnumerable`1 commandBatches, IRelationalConnection
connection, CancellationToken cancellationToken)
at
IBM.EntityFrameworkCore.Update.Internal.Db2BatchExecutor.Execute
Async(IEnumerable`1 commandBatches, IRelationalConnection
connection, CancellationToken cancellationToken)
at
IBM.EntityFrameworkCore.Update.Internal.Db2BatchExecutor.Execute
Async(IEnumerable`1 commandBatches, IRelationalConnection
connection, CancellationToken cancellationToken)
at
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManag
er.SaveChangesAsync(IList`1 entriesToSave, CancellationToken
cancellationToken)
at
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManag
er.SaveChangesAsync(DbContext _, Boolean
acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at
Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean
acceptAllChangesOnSuccess, CancellationToken cancellationToken)
System.ArgumentException: An item with the same key has already
been added. Key: p98
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key,
TValue value, InsertionBehavior behavior) at
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBa
tch.CreateStoreCommand()
at
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBa
tch.ExecuteAsync(IRelationalConnection connection,
CancellationToken cancellationToken)
at
IBM.EntityFrameworkCore.Update.Internal.Db2BatchExecutor.Execute
Async(IEnumerable`1 commandBatches, IRelationalConnection
connection, CancellationToken cancellationToken)
at
IBM.EntityFrameworkCore.Update.Internal.Db2BatchExecutor.Execute
Async(IEnumerable`1 commandBatches, IRelationalConnection
connection, CancellationToken cancellationToken)
at
IBM.EntityFrameworkCore.Update.Internal.Db2BatchExecutor.Execute
Async(IEnumerable`1 commandBatches, IRelationalConnection
connection, CancellationToken cancellationToken)
at
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManag
er.SaveChangesAsync(IList`1 entriesToSave, CancellationToken
cancellationToken)
at
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManag
er.SaveChangesAsync(DbContext _, Boolean
acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at
Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean
acceptAllChangesOnSuccess, CancellationToken cancellationToken)
Problem Summary:
****************************************************************
* USERS AFFECTED:                                              *
* DB2 Connect .NET EF Core 5.0 users                           *
****************************************************************
* PROBLEM DESCRIPTION:                                         *
* See Error Description                                        *
****************************************************************
* RECOMMENDATION:                                              *
* Upgrade to IBM Entity Framework Core Provider version        *
* 5.0.0.500 NuGet package                                      *
* NuGet packages are located:                                  *
* https://www.nuget.org/packages/IBM.EntityFrameworkCore/5.0.0 *
* .500                                                         *
* https://www.nuget.org/packages/IBM.EntityFrameworkCore-lnx/5 *
* .0.0.500                                                     *
* https://www.nuget.org/packages/IBM.EntityFrameworkCore-osx/5 *
* .0.0.500                                                     *
****************************************************************
Local Fix:
Configure MaxBatchSize to 42.
For example :

options.UseDb2(, p =>
{ p.SetServerInfo(, );
p.MaxBatchSize(42); }))
Solution
Workaround
****************************************************************
* USERS AFFECTED:                                              *
* DB2 Connect .NET EF Core 5.0 users                           *
****************************************************************
* PROBLEM DESCRIPTION:                                         *
* See Error Description                                        *
****************************************************************
* RECOMMENDATION:                                              *
* Upgrade to IBM Entity Framework Core Provider version        *
* 5.0.0.500 NuGet package                                      *
* NuGet packages are located:                                  *
* https://www.nuget.org/packages/IBM.EntityFrameworkCore/5.0.0 *
* .500                                                         *
* https://www.nuget.org/packages/IBM.EntityFrameworkCore-lnx/5 *
* .0.0.500                                                     *
* https://www.nuget.org/packages/IBM.EntityFrameworkCore-osx/5 *
* .0.0.500                                                     *
****************************************************************
Comment
Problem fixed in IBM Entity Framework Core Provider  and will be
available on NuGet via version 5.0.0.500.
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
26.10.2021
10.01.2022
10.01.2022
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
invispix 10x10
invispix 10x10
Versions InfomailVersions Infomail

Versions Infomail

Product LifecycleProduct Lifecycle

Lifecycle

Current BugsCurrent Bugs

Current Bugs

Bug ResearchBug Research

Bug Research

Bug FixlistsBug Fixlists

Bug Fixlists

invispix 10x10