Closed nowinski closed 3 years ago
ActivityController line 540 returns NULL when no details are found in DB and cannot be cast to INT.
nextRowId = (int)cmd.ExecuteScalar() + 1;
Proposed fix: --check cmd.ExecuteScalar() --when NULL, set nextRowId = 1 --otherwise, nextRowId = (int)cmd.ExecuteScalar() + 1;
Reported by Tyler 10/22/2020
We’ve found another strange behavior in the data editor. It sounds like you have a copy of our database now so I will try to make this reproduceable.
The activity where we discovered this is: • Project: Johnson Creek Artificial Propagation and Enhancement M&E-SGS Redd Data • Location: Johnson Creek: Transect – 1 (54) • Date: 08/24/2020 • Pass 2
The two NA records are what I am trying to add to the activity – there were 0 records to begin with. It also shows NO ERRORS for those 2 new records.
{Message: "An error has occurred.", ExceptionMessage: "One or more errors occurred.",…} ExceptionMessage: "One or more errors occurred." ExceptionType: "System.AggregateException" InnerException: {Message: "An error has occurred.", ExceptionMessage: "Specified cast is not valid.",…} ExceptionMessage: "Specified cast is not valid." ExceptionType: "System.InvalidCastException" "An error has occurred." StackTrace: " at services.Controllers.ActivityController.UpdateDatasetActivities_SQL(JObject jsonData) in C:\cdms-dev\cdms-be-public\services\Controllers\ActivityController.cs:line 540 at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.b 9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionaryd__1.MoveNext()"
2 arguments, CancellationToken cancellationToken) End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext() End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()" Message: "An error has occurred." StackTrace: " at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.Tasks.Task.Execute() End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.