0

I am facing following error while calling simple GET method of my controller:

**Message**: 
Arithmetic operation resulted in an overflow.
**StackTrace**: 
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.BufferlessMoveNext(Boolean buffer)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](Func`2 operation, Func`2 verifySucceeded, TState state)
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Linq.SystemCore_EnumerableDebugView`1.get_Items()

And my GET method is as follows:

[HttpGet]
public IEnumerable<Categories> GetCategories()
{
   var data = _context.Categories;
   return data;
}

So please let me know how to resolve the issue?

Thanks,

Kunal Kakkad

5
  • 2
    Have you searched for "TryGetConnection Arithmetic overflow"? I found this SO Question and this Other SO Question and this Github Discussion. What have you tried? Commented Oct 30, 2017 at 16:34
  • 2
    Please, Can you show your definition for Categories entity and mapping? Commented Oct 31, 2017 at 5:37
  • @Forty3: I had checked all these. But none of them worked. Commented Oct 31, 2017 at 13:55
  • @H.Herzl: modelBuilder.Entity<Categories>(entity => { entity.HasKey(e => e.CategoryId) .HasName("PK_Categories"); entity.Property(e => e.CategoryDescription).HasMaxLength(500); entity.Property(e => e.CategoryName) .IsRequired() .HasMaxLength(100); entity.Property(e => e.CreatedDate).HasColumnType("datetime"); }); Commented Oct 31, 2017 at 13:55
  • Please edit your question, add the mapping and entity definition Commented Nov 3, 2017 at 3:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.