This is a migrated thread and some comments may be shown as answers.

NullReferenceException in StyleManager.GetTheme

5 Answers 207 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Henri
Top achievements
Rank 1
Henri asked on 31 Jul 2012, 10:17 AM
Hi,

When editing a value in a GridView Cell, I get an exception when pressing Enter. My entered value is accepted however.
I am using Version 2012 Q2 SP1

   at Telerik.Windows.Controls.StyleManager.GetTheme(DependencyObject element) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\StyleManager.cs:line 85
   at Telerik.Windows.Controls.GridView.GridViewCell.get_EditorPresenter() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 240
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ValidateCell(GridViewCell cell) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 285
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformCellValidation(GridViewCell cell) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 214
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitCellEdit(GridViewCell currentCell, Boolean isLeavingRow) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 60
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitEdit() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 1105
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCommitEditCommand(Object sender, ExecutedRoutedEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Commands.cs:line 298
   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 Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Commands.cs:line 73
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PendAndExecuteCommands(KeyEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3940
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3913
   at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
   at System.Windows.Input.KeyEventArgs.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.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.TranslateAcceleratorCore(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.System.Windows.Interop.IKeyboardInputSink.TranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Forms.Integration.ElementHost.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
   at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(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 ProjectControl.Program.Main(String[] args) in C:\Users\Marc.Vanhoecke\Documents\Visual Studio 2010\Projects\ProjectControl\ProjectControl\Program.cs:line 31
   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()

I'm still using the Themes the old way. (telerik:StyleManager.Theme="Windows7") in XAML

Best regards,
Henri

5 Answers, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 31 Jul 2012, 02:50 PM
Hi Henri,

I've tested your case and I was not able to reproduce the reported exception. Can you check my test application and modify it in order to achieve the exception? Thank you in advance.
 
Greetings,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Eric
Top achievements
Rank 1
answered on 28 Jan 2013, 10:23 PM
I am getting the exact same issue.

A couple items of note, I have an event being raised by the data member changing (in my case a comboboxcolumn).  This event is listened to in order to update the grid to highlight cells based on certain conditions.  Thus, I have to call a .Rebind() on the datagrid.  If I remove the call to .Rebind() everything works perfectly, it's only with that call in place that things break.  The results of a single dropdown alter the entire grids highlighting rules.

Is it possible that since I'm calling the .Rebind() from an event triggered by the data member changing that when Telerik then continues on it's execution after the rebind and tries to apply styling for the row changed it's no longer a valid reference due to my rebind?  If this is the case, how do I STOP the change event from trying to apply styling itself?  
0
Yordanka
Telerik team
answered on 29 Jan 2013, 12:50 PM
Hi Eric,

Thank you for the feedback.

Could you test your solution with our latest official binaries - Q3 2012 SP1? In case the problem still occurs, please open a support ticket and send us a sample project which demonstrates the issue. We will debug it on our side and will assist you further.
 
All the best,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
guillaume
Top achievements
Rank 1
answered on 30 Jan 2013, 05:12 PM
Hello,

we've got exactly the same issue with Telerik Q3 SP1 (version number is 2012.3.1129.40). Regarding our issue it happens when we enter a null value (pressing del and validating with enter).

The setter of our view model is reached. Then the value is set to null in our viewmodel then the getter is called by GridView, it returns null, the application crashes.

However, the first time the grid is displayed if we have a null value everything is displayed properly, not crash happens. It is only after a user modification that the issue occurs.

Best regards,

Guillaume Torrente.
0
Yordanka
Telerik team
answered on 01 Feb 2013, 12:06 PM
Hi Guillaume,

Thank you for the feedback.

Unfortunately, we were not able to reproduce the problem locally. Could you setup a sample runnable project which reproduces it? We will debug it on our side and will assist you further.
Please open a support ticket in order to attach a project. Thank you in advance.
 
Greetings,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Henri
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Eric
Top achievements
Rank 1
guillaume
Top achievements
Rank 1
Share this question
or