System.NullReferenceException was unhandled
Message="Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu."
Source="Mindscape.LightSpeed.Linq"
StackTrace:
w Mindscape.LightSpeed.Linq.Plan.LinqQueryPlanExpression.ExtractRangeVariablesFromNewExpression(Expression expr)
w Mindscape.LightSpeed.Linq.Plan.LinqQueryPlanExpression.ExtractRangeVariables(Expression expression)
w Mindscape.LightSpeed.Linq.Plan.LinqQueryPlanExpression.ExtractRangeVariables(Expression expression)
w Mindscape.LightSpeed.Linq.Sqo.Select.Evaluate(ExpressionVisitor visitor, MethodCallExpression expression)
w Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.VisitMethodCall(MethodCallExpression exp)
w Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Visit(Expression exp)
w Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Build(Expression translation, LinqQueryProvider provider)
w Mindscape.LightSpeed.Linq.LinqQueryProvider.GetExecutionPlan(Expression expression)
w Mindscape.LightSpeed.Linq.LinqQueryProvider.Execute(Expression expression)
w Mindscape.LightSpeed.Linq.LinqQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)
w Mindscape.LightSpeed.Linq.LinqQuery`1.GetEnumerator()
w System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
w System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
w Manager.Events.EventViewModel.LoadAllEvents() w F:\Checkout\areva.spdc\Manager\Manager\EventViewModel.cs:wiersz 27
w Manager.PageEvents.m_btn_events_open_Click(Object sender, RoutedEventArgs e) w F:\Checkout\areva.spdc\Manager\Manager\PageEvents.xaml.cs:wiersz 47
w System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
w System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
w System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
w System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
w System.Windows.Controls.Primitives.ButtonBase.OnClick()
w System.Windows.Controls.Button.OnClick()
w System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
w System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
w System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
w System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
w System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
w System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
w System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
w System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e)
w System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
w System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
w System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
w System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
w System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
w System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
w System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
w System.Windows.Input.InputManager.ProcessStagingArea()
w System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
w System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
w System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
w System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
w System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
w MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
w MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
w System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
w System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
w System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
w System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
w MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
w MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
w System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
w System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
w System.Windows.Threading.Dispatcher.Run()
w System.Windows.Application.RunDispatcher(Object ignore)
w System.Windows.Application.RunInternal(Window window)
w System.Windows.Application.Run(Window window)
w System.Windows.Application.Run()
w Manager.App.Main() w F:\Checkout\areva.spdc\Manager\Manager\obj\Release\App.g.cs:wiersz 0
w System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
w System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
w Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
w System.Threading.ThreadHelper.ThreadStart_Context(Object state)
w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
w System.Threading.ThreadHelper.ThreadStart()
InnerException:
This is how I created the context and the unit of work :
LightSpeedContext<EventsLogModelUnitOfWork> m_ctx = new LightSpeedContext<EventsLogModelUnitOfWork>()
{
ConnectionString = String.Format("data source={0}", dbname),
DataProvider = DataProvider.SQLite3
};
EventsLogModelUnitOfWork m_unit = m_ctx.CreateUnitOfWork();
And the below code generated the exception
if (Events != null && m_database != null)
{
Events.Clear();
Events = m_unit.EventsLogs
.Select(ev => new EventModel(ev))
.ToList();
}
What did I mess up?