Telerik UI for WPF => Object refrence not set to an instance of an object.

3 posts, 0 answers
  1. Alen
    Alen avatar
    2 posts
    Member since:
    May 2018

    Posted 19 Jun Link to this post

    Hi,

    I have just strated creating a Telerik WPF application, added a RadButton in a RadWindow and whenever I click on any of the buttons on the Window(minimze, maximize or RadButton) the application crashes. The debugg mode throws System.NullReferenceException: 'Object reference not set to an instance of an object.'

    I have added references, of which are Telerik.Windows.Controls, Telerik.Windows.Controls.Data, Telerik.Windows.Controls.Input, Telerik.Windows.Controls.Navigation, Telerik.Windows.Data, for Telerik to the project, version: 2019.1.220.45 (of all references).

    The call stack shows this output: 

    >Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.WindowBase.OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)Unknown
     PresentationCore.dll!System.Windows.UIElement.OnGotKeyboardFocusThunk(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)Unknown
     PresentationCore.dll!System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget)Unknown
     PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target)Unknown
     PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs)Unknown
     PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised)Unknown
     PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args)Unknown
     PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args)Unknown
     PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args, bool trusted)Unknown
     PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea()Unknown
     PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input)Unknown
     PresentationCore.dll!System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject focus, int timestamp)Unknown
     PresentationCore.dll!System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject newFocus, System.Windows.Input.IKeyboardInputProvider keyboardInputProvider, bool askOld, bool askNew, bool forceToNullIfFailed)Unknown
     PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject focus, bool askOld, bool askNew, bool forceToNullIfFailed)Unknown
     PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement element)Unknown
     PresentationCore.dll!System.Windows.UIElement.Focus()Unknown
     PresentationFramework.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)Unknown
     PresentationCore.dll!System.Windows.UIElement.OnMouseLeftButtonDownThunk(object sender, System.Windows.Input.MouseButtonEventArgs e)Unknown
     PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget)Unknown
     PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target)Unknown
     PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs)Unknown
     PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised)Unknown
     PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args, System.Windows.RoutedEvent newEvent)Unknown
     PresentationCore.dll!System.Windows.UIElement.OnMouseDownThunk(object sender, System.Windows.Input.MouseButtonEventArgs e)Unknown
     PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget)Unknown
     PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target)Unknown
     PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs)Unknown
     PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised)Unknown
     PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args)Unknown
     PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args)Unknown
     PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args, bool trusted)Unknown
     PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea()Unknown
     PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input)Unknown
     PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport)Unknown
     PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel)Unknown
     PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd, MS.Internal.Interop.WindowMessage msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)Unknown
     PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)Unknown
     WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)Unknown
     WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)Unknown
     WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)Unknown
     WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler)Unknown
     WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)Unknown
     WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)Unknown
     [Native to Managed Transition]
     [Managed to Native Transition]
     WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)Unknown
     WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame)Unknown
     PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)Unknown
     PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)Unknown
     PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window)Unknown
     PresentationFramework.dll!System.Windows.Application.Run()Unknown
     Project3.exe!Project3.App.Main()Unknown

     

    I cannot find the stack trace since I don't have .pdb files(can't find them(except reporting.wpf.pdb) in the installation folder).

    I'm attaching the solution.

    I'm using Visual Studio 2017 Community Edition.

     

    Hope you can solve the issue.

     

    Sincerely,

    Josip

     


  2. Alen
    Alen avatar
    2 posts
    Member since:
    May 2018

    Posted 19 Jun in reply to Alen Link to this post

    Sorry I can't attach the .zips, can you please delete the post I will send a ticket
  3. Dimitar Dinev
    Admin
    Dimitar Dinev avatar
    72 posts

    Posted 20 Jun Link to this post

    Hi Alen,

    I explained it in your ticket and will copy the text from it, so the people in the forum with the same question can see the answer.


    In order to use RadWindow as a MainWindow, you need to delete the StartupUri in App.xaml and override the OnStartup method in App.xaml.cs:
    protected override void OnStartup(StartupEventArgs e)
            {
                new MainWindow().Show();
                base.OnStartup(e);
            }

    You can read more in the How to use RadWindow as main Window article.

    Regards,
    Dimitar Dinev
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top