Во время генерации отчёта получаю NRE:
System.NullReferenceException was unhandled Message=Object reference not set to an instance of an object. Source=Ecng.Trading.Algo StackTrace: at Ecng.Trading.Algo.TraderHelper.GetMarketPrice(MarketDepthPair bestPair, OrderDirections direction, Unit priceDelta, MarketPriceTypes priceType) at Ecng.Trading.Algo.TraderHelper.GetMarketPrice(Security security, OrderDirections direction, Unit priceDelta, MarketPriceTypes priceType) at Ecng.Trading.Algo.TraderHelper.GetPnL(Security security, Int64 position) at Ecng.Trading.Algo.PnL.BasePnLManager.#=qz1Pkad79BLeG2zoFC7yZRg==(KeyValuePair
2 #=qHo8yqiDKe24tIIMpwIwDzQ==) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.Sum(IEnumerable1 source) at Ecng.Trading.Algo.PnL.BasePnLManager.#=qpKurmy48WsO2SD4_Xp_sKw==(SynchronizedDictionary2 #=qUPvW0wVJA2FikCQK_objkg==) at Ecng.Collections.CollectionHelper.SyncGet[TCollection,TResult](TCollection collection, Func`2 func) at Ecng.Trading.Algo.PnL.BasePnLManager.get_PnL() at Ecng.Trading.Algo.Reporting.XmlStrategyReport.Generate() at Robots.MainWindow.MainWindow.GenerateStrategyReports(Strategy strategy) in c:\Users\Alexander\Documents\Visual Studio 2010\Projects\Robots\Robots\MainWindow\MainWindow.xaml.cs:line 71 at Robots.MainWindow.MainWindow.OnClosing(CancelEventArgs e) in c:\Users\Alexander\Documents\Visual Studio 2010\Projects\Robots\Robots\MainWindow\MainWindow.xaml.cs:line 136 at System.Windows.Window.WmClose() at System.Windows.Window.WindowFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at Robots.App.Main() in c:\Users\Alexander\Documents\Visual Studio 2010\Projects\Robots\Robots\obj\x86\Debug\App.g.cs:line 0 InnerException:
На предыдущих версиях такой ошибки не было.
Comments (2)
Login or Create account, Log in or register to leave a comment
У меня подобная же ошибка возникла. Сообщение и стек:
Да, ошибка возникла в связи с отсутствием информации в Security.BestPair. Причина - теперь информация по инструментам урезана. Буду чинить.