efcore icon indicating copy to clipboard operation
efcore copied to clipboard

System.InvalidOperationException when doing a DbSet<T>.Single()

Open Praburaj opened this issue 12 years ago • 2 comments

System.InvalidOperationException was unhandled by user code
  HResult=-2146233079
  Message=Sequence contains no elements
  Source=System.Core
  StackTrace:
       at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
       at Microsoft.Data.Entity.Query.EntityQueryExecutor.ExecuteSingle[T](QueryModel queryModel, Boolean returnDefaultWhenEmpty)
       at Remotion.Linq.Clauses.StreamedData.StreamedSingleValueInfo.ExecuteSingleQueryModel[T](QueryModel queryModel, IQueryExecutor executor)
       at Remotion.Linq.Clauses.StreamedData.StreamedSingleValueInfo.ExecuteQueryModel(QueryModel queryModel, IQueryExecutor executor)
       at Remotion.Linq.QueryModel.Execute(IQueryExecutor executor)
       at Remotion.Linq.QueryProviderBase.Execute(Expression expression)
       at Remotion.Linq.QueryProviderBase.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
       at System.Linq.Queryable.Single[TSource](IQueryable`1 source, Expression`1 predicate)
       at MusicStore.Controllers.StoreController.Browse(String genre) in D:\K\src\MusicStore\src\MusicStore\Controllers\StoreController.cs:line 34
  InnerException: 

MusicStore has several scenarios broken due to this just in case you need a repro.

Praburaj avatar May 23 '14 20:05 Praburaj

Probably a dupe of #255

rowanmiller avatar May 28 '14 18:05 rowanmiller

This is fixed now. Closing this bug.

Praburaj avatar May 28 '14 18:05 Praburaj