Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF Core + CosmosDB: Index was outside the bounds of the array. #14836

Closed
TomasHubelbauer opened this issue Feb 26, 2019 · 3 comments
Closed

EF Core + CosmosDB: Index was outside the bounds of the array. #14836

TomasHubelbauer opened this issue Feb 26, 2019 · 3 comments

Comments

@TomasHubelbauer
Copy link

I have a repro here, just install the Cosmos emulator, run it and then run the repro:
https://github.com/TomasHubelbauer/cosmos-db-exploration

If you are seeing an exception, include the full exceptions details (message and stack trace).

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateAsyncQueryExecutor[TResult](QueryModel queryModel)
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, Expression expression, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, LambdaExpression expression, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.SingleAsync[TSource](IQueryable`1 source, Expression`1 predicate, CancellationToken cancellationToken)
   at cosmos_db_exploration.Program.Main(String[] args) in C:\Users\tohubelb\Desktop\cosmos-db-exploration\Program.cs:line 54
   at cosmos_db_exploration.Program.<Main>(String[] args)

Steps to reproduce

  1. https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator
  2. https://github.com/TomasHubelbauer/cosmos-db-exploration

Further technical details

EF Core version: 2.2.0-preview2-35157 if project.assets.json is to be believed
Database Provider: [email protected]
Operating system: Windows 10 Pro
IDE: VS Code

@TomasHubelbauer
Copy link
Author

This relates to #14491, #13176 and #1488 - maybe. Happens with or without the Include call.

@vflame
Copy link

vflame commented Mar 9, 2019

Experiencing same exception when using ThenInclude() on a large dataset. The initial Include() is working fine.

Here's the stack trace:

at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.Snapshot`8.set_Item(Int32 index, Object value) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetRelationshipSnapshotValue(IPropertyBase propertyBase, Object value)
at lambda_method(Closure , QueryContext , IncomingData , Object[] )
at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler._Include[TEntity](QueryContext queryContext, TEntity entity, Object[] included, Action`3 fixup)
 at lambda_method(Closure , TransparentIdentifier`2 )
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider._TrackEntities[TOut,TIn](IEnumerable`1 results, QueryContext queryContext, IList`1 entityTrackingInfos, IList`1 entityAccessors)+MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)`

@TomasHubelbauer
Copy link
Author

The Microsoft.EntityFrameworkCore.Cosmos.Sql was unlisted, which I didn't notice initially. I have switched to the Microsoft.EntityFrameworkCore.Cosmos package and updated my repro repo accordingly. Now I am no longer able to reproduce the crash. I am going to close this issue.

@vflame let me know if it still crashes for you with the right package in case you have been using the unlisted one as I have (UseCosmosSql becomes UseCosmos) and if yes, I will reopen.

@ajcvickers ajcvickers removed this from the 3.0.0 milestone Mar 11, 2019
@smitpatel smitpatel removed their assignment Jan 12, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants