Skip to main content

280 posts tagged with "C#"

C# Programming Language

View All Tags

Fixed: "Fatal error encountered during command execution" and "Reading from the stream has failed" with MySql.Data

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Fatal error encountered during command execution sounds like something is badly wrong with the statement. Read the inner exceptions, and it ends with Attempted to read past the end of the stream: the connection went away while the driver was waiting for an answer. The statement isn't the problem, and it's usually worth trying again.

Fixed: "NullReferenceException" at MySqlCommand.ExecuteNonQueryInternalAsync After KILL QUERY

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A statement was stuck behind a row lock, so I stopped it with KILL QUERY. The mysql client reports that as ERROR 1317: Query execution was interrupted. My API got System.NullReferenceException from inside MySql.Data. It's a misleading message, and once you know that, it tells you exactly what happened.

Fixed: "NullReferenceException" at NativeDriver.ExecutePacketAsync During a MySQL Restart in EF Core

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

MySQL restarted while orders were coming in. The retries did their job for most requests, and then 8 of 96 failed with System.NullReferenceException from deep inside MySql.Data. None of my code was in the failing frames. A retry was using a connection that the driver had left marked as open.

Fixed: "RetryLimitExceededException: The maximum number of retries (3) was exceeded" in EF Core with MySQL

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A request took about 4 seconds, and then failed with RetryLimitExceededException: The maximum number of retries (3) was exceeded while executing database operations. That exception means EF Core did its job and ran out of attempts. The cause is one level down, and the client deserves a better answer than a 500.

Fixed: "error CS8031: Async lambda expression converted to a 'Task' returning delegate cannot return a value"

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

Wrapping an endpoint's work in strategy.ExecuteAsync gave error CS8031: Async lambda expression converted to a 'Task' returning delegate cannot return a value. The code looks right, and it returns values on purpose. The compiler just can't work out one type for those values, and a small addition tells it.

Fixed: "The configured execution strategy 'MySQLRetryingExecutionStrategy' does not support user-initiated transactions" in EF Core

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

As soon as I wrapped two writes in BeginTransactionAsync, the endpoint failed with The configured execution strategy 'MySQLRetryingExecutionStrategy' does not support user-initiated transactions. The message tells you the method to use, and here's the shape of the code it means.

Fixed: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool" with MySql.Data

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

A request that normally takes a millisecond failed after exactly 15 seconds with error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. MySQL itself was fine and nearly idle. All the app's connections were taken, by requests that were never going to finish.