Readonly fields in business objects trigger a linq exception

Readonly fields in business objects trigger a linq exception

Old forum URL: forums.lhotka.net/forums/t/9540.aspx


Calin posted on Wednesday, September 15, 2010

Hi,

I have a business object that contains this field:

private readonly bool _settingTheNumberOfDays;

Now when I try to edit an object I get a linq exception thrown "Expression must be writeable Parameter name: left".

I think this is a bug. I took me a wile to figure out the above field was causing me the issue.

 

Regards,

RockfordLhotka replied on Wednesday, September 15, 2010

Can you provide the ToString() of the exception object? Otherwise we don't know the source of the exception.

Calin replied on Friday, September 17, 2010

 at System.Linq.Expressions.Expression.RequiresCanWrite(Expression 
expression, String paramName)
   at System.Linq.Expressions.Expression.Assign(Expression left, 
Expression right)
   at 
Csla.Reflection.DynamicMethodHandlerFactory.CreateFieldSetter(FieldInfo 
field)
   at Csla.Reflection.DynamicMemberHandle..ctor(FieldInfo info)
   at Csla.Core.UndoableHandler.BuildHandlers(Type type)
   at Csla.Core.UndoableHandler.GetCachedFieldHandlers(Type type)
   at Csla.Core.UndoableBase.CopyState(Int32 parentEditLevel)
   at Csla.Core.BusinessBase.BeginEdit()
   at 
Csla.Core.BusinessBase.System.ComponentModel.IEditableObject.BeginEdit()
   at 
Telerik.Windows.Data.QueryableCollectionView.<BeginEditItem>b__0(IEditableObject 
i)
   at Telerik.Windows.Data.QueryableCollectionView.ExecuteAs[T](Object 
item, Action`1 action)
   at Telerik.Windows.Data.QueryableCollectionView.BeginEditItem(Object 
item)
   at Telerik.Windows.Data.QueryableCollectionView.EditItem(Object item)
   at Telerik.Windows.Data.DataItemCollection.EditItem(Object item)
   at 
Telerik.Windows.Controls.GridView.GridViewDataControl.set_RowInEditMode(GridViewRow 
value)
   at 
Telerik.Windows.Controls.GridView.GridViewRow.IsInEditModeChanged(DependencyObject 
dependencyObject, DependencyPropertyChangedEventArgs e)
   at 
System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs 
e)
   at 
System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs 
e)
   at 
System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs 
args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex 
entryIndex, DependencyProperty dp, PropertyMetadata metadata, 
EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean 
coerceWithDeferredReference, Boolean coerceWithCurrentValue, 
OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty 
dp, Object value, PropertyMetadata metadata, Boolean 
coerceWithDeferredReference, Boolean coerceWithCurrentValue, 
OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, 
Object value)
   at 
Telerik.Windows.Controls.GridView.GridViewRow.set_IsInEditMode(Boolean 
value)
   at 
Telerik.Windows.Controls.GridView.GridViewDataControl.OnCellEditModeChanged(GridViewCell 
cell, Boolean newIsInEditMode)
   at 
Telerik.Windows.Controls.GridView.GridViewCell.IsInEditModeChanged(DependencyObject 
target, DependencyPropertyChangedEventArgs e)
   at 
System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs 
e)
   at 
System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs 
e)
   at 
System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs 
args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex 
entryIndex, DependencyProperty dp, PropertyMetadata metadata, 
EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean 
coerceWithDeferredReference, Boolean coerceWithCurrentValue, 
OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty 
dp, Object value, PropertyMetadata metadata, Boolean 
coerceWithDeferredReference, Boolean coerceWithCurrentValue, 
OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, 
Object value)
   at 
Telerik.Windows.Controls.GridView.GridViewCell.set_IsInEditMode(Boolean 
value)
   at 
Telerik.Windows.Controls.GridView.GridViewDataControl.SwitchCellToEditMode(GridViewCell 
cell)
   at 
Telerik.Windows.Controls.GridView.GridViewDataControl.BeginEdit(GridViewCell 
gridViewCell, RoutedEventArgs editingEventArgs)
   at 
Telerik.Windows.Controls.GridView.GridViewDataControl.BeginEdit(GridViewCell 
gridViewCell)
   at 
Telerik.Windows.Controls.GridView.GridViewDataControl.OnCellMouseDown(GridViewCell 
cell)
   at 
Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs 
e)
   at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object 
sender, MouseButtonEventArgs e)
   at 
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate 
genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, 
Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object 
target, RoutedEventArgs routedEventArgs)
   at System.Windows.RouteItem.InvokeHandler(RoutedEventArgs 
routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, 
RoutedEventArgs args, Boolean reRaised)
   at System.Windows.EventRoute.ReInvokeHandlers(Object source, 
RoutedEventArgs args)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, 
RoutedEventArgs args, RoutedEvent newEvent)
   at 
System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject 
sender, MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, 
MouseButtonEventArgs e)
   at 
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate 
genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, 
Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object 
target, RoutedEventArgs routedEventArgs)
   at System.Windows.RouteItem.InvokeHandler(RoutedEventArgs 
routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, 
RoutedEventArgs args, Boolean reRaised)
   at System.Windows.EventRoute.InvokeHandlers(Object source, 
RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, 
RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean 
trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport 
inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr 
hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, 
Int32 y, Int32 wheel)
   at 
System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, 
WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(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.ExceptionWrapper.TryCatchWhen(Object 
source, Delegate callback, Object args, Int32 numArgs, Delegate 
catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate 
callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate 
callback, Object args, Int32 numArgs)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority 
priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority 
priority, Delegate method, Object arg)
   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.TranslateAndDispatchMessage(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 Oncare.Shell.App.Main() in 
D:\Work\calin_oncare\Source\Oncare.Shell\obj\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, 
String[] args)
   at 
System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext 
activationContext, String[] activationCustomData)
   at 
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
   at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state, Boolean 
ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

RockfordLhotka replied on Friday, September 17, 2010

It does appear that LINQ is trying to set some field and CSLA is unable to provide a setter for it.

If you are running CSLA 3.x, try doing a ToList() on your collection in the LINQ query - thus avoiding the use of the custom CSLA query provider.

If you are in CSLA 4 then this is purely something to do with LINQ, since CSLA 4 has no custom query provider.

bniemyjski replied on Friday, October 01, 2010

Hello,

I just found an issue with CSLA 4 (might be in CSLA 3.8). We have a DynamicListBase and EditableRoot's bound to a wpf grid. When you double click on a line item you get the following error:

A first chance exception of type 'System.ArgumentException' occurred in System.Core.dll

System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>WpfApplication1.vshost.exe</AppDomain><Exception><ExceptionType>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Expression must be writeable

Parameter name: left</Message><StackTrace>   at System.Linq.Expressions.Expression.RequiresCanWrite(Expression expression, String paramName)

   at System.Linq.Expressions.Expression.Assign(Expression left, Expression right)

   at Csla.Reflection.DynamicMethodHandlerFactory.CreateFieldSetter(FieldInfo field)

   at Csla.Reflection.DynamicMemberHandle..ctor(FieldInfo info)

   at Csla.Core.UndoableHandler.BuildHandlers(Type type)

   at Csla.Core.UndoableHandler.GetCachedFieldHandlers(Type type)

   at Csla.Core.UndoableBase.CopyState(Int32 parentEditLevel)

   at Csla.Core.BusinessBase.BeginEdit()

   at Csla.Core.BusinessBase.System.ComponentModel.IEditableObject.BeginEdit()

   at System.Windows.Data.ListCollectionView.EditItem(Object item)

   at System.Windows.Controls.ItemCollection.System.ComponentModel.IEditableCollectionView.EditItem(Object item)

   at System.Windows.Controls.DataGrid.EditRowItem(Object rowItem)

   at System.Windows.Controls.DataGrid.OnExecutedBeginEdit(ExecutedRoutedEventArgs e)

   at System.Windows.Controls.DataGrid.OnExecutedBeginEdit(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)

   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)

   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)

   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)

   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)

   at System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)

   at System.Windows.Controls.DataGrid.BeginEdit(RoutedEventArgs editingEventArgs)

   at System.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDown(MouseButtonEventArgs e)

   at System.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)

   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)

   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)

   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)

   at System.Windows.Input.InputManager.ProcessStagingArea()

   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)

   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)

   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)

   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)

   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)

   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; 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.DispatchMessage(MSG&amp;amp; 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 WpfApplication1.App.Main() in D:\Downloads\PetShop\PetShop\WpfApplication1\obj\x86\Debug\App.g.cs:line 0

   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.ArgumentException: Expression must be writeable

Parameter name: left

   at System.Linq.Expressions.Expression.RequiresCanWrite(Expression expression, String paramName)

   at System.Linq.Expressions.Expression.Assign(Expression left, Expression right)

   at Csla.Reflection.DynamicMethodHandlerFactory.CreateFieldSetter(FieldInfo field)

   at Csla.Reflection.DynamicMemberHandle..ctor(FieldInfo info)

   at Csla.Core.UndoableHandler.BuildHandlers(Type type)

   at Csla.Core.UndoableHandler.GetCachedFieldHandlers(Type type)

   at Csla.Core.UndoableBase.CopyState(Int32 parentEditLevel)

   at Csla.Core.BusinessBase.BeginEdit()

   at Csla.Core.BusinessBase.System.ComponentModel.IEditableObject.BeginEdit()

   at System.Windows.Data.ListCollectionView.EditItem(Object item)

   at System.Windows.Controls.ItemCollection.System.ComponentModel.IEditableCollectionView.EditItem(Object item)

   at System.Windows.Controls.DataGrid.EditRowItem(Object rowItem)

   at System.Windows.Controls.DataGrid.OnExecutedBeginEdit(ExecutedRoutedEventArgs e)

   at System.Windows.Controls.DataGrid.OnExecutedBeginEdit(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)

   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)

   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)

   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)

   at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)

   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)

   at System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)

   at System.Windows.Controls.DataGrid.BeginEdit(RoutedEventArgs editingEventArgs)

   at System.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDown(MouseButtonEventArgs e)

   at System.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)

   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)

   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)

   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)

   at System.Windows.Input.InputManager.ProcessStagingArea()

   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)

   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)

   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)

   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)

   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)

   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; 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.DispatchMessage(MSG&amp;amp; 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 WpfApplication1.App.Main() in D:\Downloads\PetShop\PetShop\WpfApplication1\obj\x86\Debug\App.g.cs:line 0

   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ThreadHelper.ThreadStart()</ExceptionString><DataItems><Data></Data></DataItems></Exception></TraceRecord>

 

I have narrowed it down to this method which was implemented for composite key support:


        #region Protected Overriden Method(s)

        // NOTE: This is needed for Composite Keys. 
        private readonly Guid _guidID = Guid.NewGuid();
        protected override object GetIdValue()
        {
            return _guidID;
        }

        #endregion
If one comments it out then everything works. Can you add this to the CSLA 4.1 bug list or should I?

 

Thanks

-Blake Niemyjski

Munish Sehgal replied on Saturday, October 30, 2010

Thanks,

your post really helped me to solve my problem.

bniemyjski replied on Friday, November 05, 2010

Hello,

Has this been fixed in CSLA 4.1?

Thanks

-Blake Niemyjski

RockfordLhotka replied on Friday, November 05, 2010

I don't know - can you test and let me know?

Copyright (c) Marimer LLC