mscorlib Value cannot be null. Parameter name: source

5 posts, 1 answers
  1. Maciek
    Maciek avatar
    5 posts
    Member since:
    Aug 2012

    Posted 18 Apr 2013 Link to this post

    Hello.
    Im developing application using .net 4, telerik (2012.3.1129.40) and mvvm light, nhibernate in WPF using visual studio 2012.

    This application is running fine on all computers (about 5-6) except one. Its small laptop with touch screen.
    What I'm facing is during load of some forms application crushes. Its mostly when i move mouse into DataFormComboBoxField
    which is binded to collection.

    Example:
         <telerik:DataFormComboBoxField ItemsSource="{Binding ErrandDocTemplates}" DisplayMemberPath="Name"
                 DataMemberBinding="{Binding SelectedErrandDocTemplate, Mode=TwoWay}" Label="Szablon" Width="430" HorizontalAlignment="Left"/>

    This project is wpf controls library hosted in WinForms application.

    Ive read couple of articles about similiar issue but i couldnt find any solution to this. 
    I tried even cleaning font cashes and update graphic drivers as its said in KB937135 but still with no success.

    Here is the stuck trace of firtst exception im getting (there is no inner exception)

    mscorlib
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at GalaSoft.MvvmLight.Helpers.WeakAction.Execute()
       at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter)
       at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at Telerik.Windows.Controls.RadButton.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseLeftButtonUpThunk(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.OnMouseUpThunk(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& 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.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 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at SDEWinForm.Program.Main() in d:\SDEControlsLibrary\SDEControlsLibrary\SDEWinForm\Program.cs:line 20
    System.Object _InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)
    Exception has been thrown by the target of an invocation.

    Value cannot be null.
    Parameter name: source

    If i handle this im getting next one:  

    System.Core
       w System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
       w System.Windows.Automation.Peers.FrameworkElementAutomationPeer.GetNameCore()
       w System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
       w System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
       w System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
       w System.Windows.ContextLayoutManager.fireAutomationEvents()
       w System.Windows.ContextLayoutManager.UpdateLayout()
       w System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       w System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       w System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       w System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       w System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       w MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       w System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       w System.Windows.Threading.DispatcherOperation.InvokeImpl()
       w System.Threading.ExecutionContext.runTryCode(Object userData)
       w System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       w System.Windows.Threading.DispatcherOperation.Invoke()
       w System.Windows.Threading.Dispatcher.ProcessQueue()
       w System.Windows.Threading.Dispatcher.WndProcHook(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, Int32 numArgs)
       w MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       w System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       w System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       w MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       w System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       w System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       w System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       w System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       w SDEWinForm.Program.Main() w d:\SDEControlsLibrary\SDEControlsLibrary\SDEWinForm\Program.cs:wiersz 20

    TSource First[TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`2[TSource,System.Boolean])

    System.Collections.ListDictionaryInternal

    System.ArgumentNullException

    I removed all Linq expressions in act od desperation but it still the same. I even turned off colums and rows virtualization on gridviews cause i've read that could be the problem.

    I obtained those errors during remote debugging with all possible exceptions checked and there is really nothing else going on.
    I'm aware of that you will probably not be able to reproduce this behavior b
    ut Ill be gratefull for any help and ideas.

    Regards
    Maciek

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 23 Apr 2013 Link to this post

    Hi,

     As far as I can see the only Telerik method invocation from the stack trace is:

    at Telerik.Windows.Controls.RadButton.OnClick()
    Then it move's to some of the MVVM light's methods, which I guess you are using to implement event-to- command.
    The second stack trace implies some issue with the automation tree. Basically, WPF builds such tree only in there is some enabled process that requires it. Usually, all of the touch devices maintain such running processes, so it is expected to reproduce it only on the touch laptop. However, I do not see Telerik methods in the second stack trace. May I ask you to send us the repro project so that we would be able to test it on our side. We would also like to know the laptop's OS version. Meanwhile, I would like to ask you to modify your scenario by replacing the DataFormComboBoxField with a standard WPF ComboBox and try to reproduce this again.Kind regards,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Maciek
    Maciek avatar
    5 posts
    Member since:
    Aug 2012

    Posted 23 Apr 2013 Link to this post

    Hi.
    Thank you for replay.
    It is HP EliteBook 2760p Tablet PC with all latest updates installed.
    The problem dissapeared after I moved to new controls q1 2013.

    Best regards
    Maciek
  5. Answer
    Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 23 Apr 2013 Link to this post

    Hi,

     I am glad to hear such good news. So that we should treat the issue as resolved :) ?

    Greetings,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Maciek
    Maciek avatar
    5 posts
    Member since:
    Aug 2012

    Posted 23 Apr 2013 Link to this post

    yes i guess :)
    BR.
Back to Top
UI for WPF is Visual Studio 2017 Ready