← 返回

[3.0.6] NRE during xml strategy report generating

Во время генерации отчёта получаю 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==(KeyValuePair2 #=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:

На предыдущих версиях такой ошибки не было.

本主题对您有帮助吗?

分享主题

评论 (2)

登录创建账户, 登录或注册以发表评论

aerv
aerv

У меня подобная же ошибка возникла. Сообщение и стек:

SysTrend1.vshost.exe Error: 0 : 02/22/2011 00:10:46 AppDomain.CurrentDomain.UnhandledException: System.NullReferenceException: В экземпляре объекта не задана ссылка на объект. в Ecng.Trading.Algo.TraderHelper.GetMarketPrice(MarketDepthPair bestPair, OrderDirections direction, Unit priceDelta, MarketPriceTypes priceType) в Ecng.Trading.Algo.TraderHelper.GetMarketPrice(Security security, OrderDirections direction, Unit priceDelta, MarketPriceTypes priceType) в Ecng.Trading.Algo.TraderHelper.GetPnL(Security security, Int32 position) в Ecng.Trading.Algo.PnL.BasePnLManager.#=q4z7hGLQmC4To4MUYrKCPoQ==(KeyValuePair2 #=q3aUBUrNM4J6zJu1AEiAHyw==) в System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() в System.Linq.Enumerable.Sum(IEnumerable1 source) в System.Linq.Enumerable.Sum[TSource](IEnumerable1 source, Func2 selector) в Ecng.Trading.Algo.PnL.BasePnLManager.#=qOb0I0vMPf2cJ1_Ce6$PaKA==(SynchronizedDictionary2 #=q8Q18He3vjGIQifyaBiyMTg==) в Ecng.Collections.CollectionHelper.SyncGet[TCollection,TResult](TCollection collection, Func`2 func) в Ecng.Trading.Algo.PnL.BasePnLManager.get_PnL() в SysTrend1.MainWindow.<OnStrategyPropertyChanged>b__a() в ...\MainWindow.xaml.cs:строка 277 ...

Mikhail Sukhov
Mikhail Sukhov

Да, ошибка возникла в связи с отсутствием информации в Security.BestPair. Причина - теперь информация по инструментам урезана. Буду чинить.