Npqsql 5.0.0-rc.1 - System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
See original GitHub issueDescribe your issue
For some reason some Xunit integration tests in my project fail with npgsql error (invoked by Linq2Db) Executing the tests “all tests in file” only - no error occurrs.
It crashes with this query:
So the query is executed but the result cannot be read.
Unfortunately I cannot provide an reproducible example since the error only occurs if dotnet test
is used - there are hundreds of tests. All Xunit test classes running against Postgres are decorated with [Collection("PostgresSequential")]
await context.Aggregates
.Where(x => x.AggregateId == aggregateId)
.Set(x => x.LastDispatchedVersion, lastDispatchedVersion)
.UpdateAsync();
Environment details
Linq To DB
version: 5.0.0-rc.1
Database (with version): Postgres latest
ADO.NET Provider (with version): ? (e.g. Microsoft.Data.SqlClient 4.1.0)
Operating system: ?
.NET Version: 6
Issue Analytics
- State:
- Created 7 months ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
System.ArgumentOutOfRangeException: Index was out of ...
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ...
Read more >Index was out of range · Issue #2628
ArgumentOutOfRangeException : 'Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')' ...
Read more >How do I resolve index was out of range. Must be non- ...
The most likely cause is that the number of rows returned from your query is not the same as the number of elements...
Read more >index was out of range. Must be non-negative and less ...
The error message is pretty explicit: Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: ......
Read more >Index was out of range. Must be non-negative and " ...
The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@HypeillingerChillinger that first example is wrong. You are disposing the context as soon as
UpdateMeAsync
returns, but at this pointUpdateAsync
is likely to not being complete. This is bad concurrent code.Ok, the query is already in outer space. Thanks