0

I have a problem with exception appearing while closing my WPF application.

  HResult=0x80131515
  Message=The Read method cannot be called when another read operation is pending.
  Source=System
  StackTrace:
   at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlDataReader.Close()
   at MySql.Data.MySqlClient.MySqlConnection.Close()
   at MySql.Data.MySqlClient.MySqlConnection.Dispose(Boolean disposing)
   at MySql.Data.MySqlClient.MySqlConnection.Finalize()

  This exception was originally thrown at this call stack:
    [External Code]
  • I am using MySQL.Data version 8.0.20
  • It appears only, when some MySQL queries working in background (like Select's from DB)
  • I am using the 'using' statements when the program opening MySQL Connections to close MySQL Connections after operations are done.

has anyone encountered this problem?

4
  • Are you closing your application whilst queries are running in the background? Commented May 4, 2020 at 13:17
  • Not familiar with the exact APIs you are using, but in general, many APIs with the potential for long run-times provide the ability to use a cancellation token that you can use to cancel the call on shutdown. Not sure if this is the case for you, but something to look into Commented May 4, 2020 at 13:20
  • I am using connection pooling in my MySQL. When I switched to pooling=false, the problem is gone. Commented May 4, 2020 at 13:31
  • @WSC yes, I am closing app while queries are running in the background. Commented May 4, 2020 at 13:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.