Sometimes no exception is thrown when
But in short: out of 60 iterations of code fragment below exception is thrown 50 times. No records are inserted with value "2"
const int timeoutSeconds = 1;
context.Database.SetCommandTimeout(timeoutSeconds);
await context.Database.ExecuteSqlRawAsync(
"""
INSERT INTO MyEntity VALUES (1);
WAITFOR DELAY '00:00:02';
INSERT INTO MyEntity VALUES (2);
""", CreateCancellationToken(TimeSpan.FromSeconds(timeoutSeconds)));
Version information
Microsoft.EntityFrameworkCore Version="8.0.6"
Microsoft.EntityFrameworkCore.SqlServer Version="8.0.6"
TargetFramework net8.0
Operating system: Windows 10
SQL Server 2022 (docker image mcr.microsoft.com/mssql/server 994123c66ce4)
Sometimes no exception is thrown when
Reproduced in https://github.com/standsed/EFTimeoutRepro/blob/main/Program.cs
But in short: out of 60 iterations of code fragment below exception is thrown 50 times. No records are inserted with value "2"
Version information
Microsoft.EntityFrameworkCore Version="8.0.6"
Microsoft.EntityFrameworkCore.SqlServer Version="8.0.6"
TargetFramework net8.0
Operating system: Windows 10
SQL Server 2022 (docker image mcr.microsoft.com/mssql/server 994123c66ce4)