When loading a streaming into a table, MySqlBulkLoader.LoadAsync() may fail with KeyNotFoundException
at System.ThrowHelper.ThrowKeyNotFoundException[T](T key)
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at MySql.Data.MySqlClient.MySqlBulkLoader.GetAndRemoveStream(String streamKey) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlBulkLoader.cs:line 241
at MySql.Data.MySqlClient.MySqlBulkLoader.<LoadAsync>d__80.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlBulkLoader.cs:line 207
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
The reason is that, when ExecuteNonQueryAsync fails
Your original exception is probably being overwritten by the KeyNotFoundException, but can you explain how or why the original failure is occurring during the bulk load?
wangjia184 commentedJan 9, 2020
When loading a streaming into a table,
MySqlBulkLoader.LoadAsync()
may fail withKeyNotFoundException
My code:
The reason is that, when
ExecuteNonQueryAsync
fails,closeStream
is not set tofalse
but the key does not exist ins_sources
.KeyNotFoundException
is raised in thefinally
block when callingGetAndRemoveSource
MySqlConnector/src/MySqlConnector/MySql.Data.MySqlClient/MySqlBulkLoader.cs
Line 209 in bec3544
The text was updated successfully, but these errors were encountered: