How to resolve the following error in your NinjaTrader Trace file
NT8 is loading historical trading executions to display on a chart and getting an invalid cast - the error is not handled and so there is a problem - NT can crash out
2024-01-12 06:50:43:206 *************** unhandled exception trapped ***************
2024-01-12 06:50:43:206 Exception has been thrown by the target of an invocation.
2024-01-12 06:50:43:206 Specified cast is not valid.
2024-01-12 06:50:43:206 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Specified cast is not valid.
at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
at System.Data.SQLite.SQLiteDataReader.GetDouble(Int32 i)
at NinjaTrader.Cbi.Execution.DbGetExecutions1(IDbCommand cmd)
at NinjaTrader.Cbi.Execution.DbGet(Account account, Instrument instrument, DateTime minTime, DateTime maxTime)
at NinjaTrader.Gui.Chart.ChartBars.LoadExecutionsByAccount(ChartBars chartBars, Account account, ChartControl chartControl)
at NinjaTrader.Gui.Chart.ChartBars.CollectExecutions(ChartControl chartControl)
at NinjaTrader.Gui.Chart.ChartControl.<>c__DisplayClass438_0.<OnGetBarsCallback>b__0(Bars bars, ChartControl chartControl, ChartBars chartBars2, Int32 generation)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
The solution
NT Support will tell you to reset the database
1) control center > Tools > database management > reset DB
2)if that doesnt work control center > Tools > database management > repairDB
3) if that doesnt work delete the database, stop NT8, \Documents\NinjaTrader 8\db\NinjaTrader.sqlite