This question is locked. New answers and comments are not allowed.
Hello,
we get a NullReferenceException, when closing a dialog with a RadAutoCompleteBox.
On closing the dialog we call our Dispose() method in the viewmodel, which clears all collections (also the one which is bound to the ItemsSource of the RadAutoCompleteBox). This will result in a NullReferenceException.
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
StackTrace:
bei Telerik.Windows.Controls.RadAutoCompleteBox.OnItemsSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
bei System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
bei System.Collections.ObjectModel.ObservableCollection`1.ClearItems()
bei System.Collections.ObjectModel.Collection`1.Clear()
bei Bdl.DialogCrm.Silverlight.ViewModels.ImportManagerViewModel.Dispose()
bei Bdl.DialogCrm.Silverlight.Core.ViewManagement.Bases.ContainerViewModelBase`1.ExecuteCloseViewInstance(ViewInstanceDescription desc)
bei Bdl.DialogCrm.Silverlight.ViewModels.MainViewModel.ExecuteCloseViewInstance(ViewInstanceDescription desc)
bei Microsoft.Practices.Prism.Commands.DelegateCommand`1.<>c__DisplayClass6.<.ctor>b__2(Object o)
bei Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter)
bei Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
bei Telerik.Windows.Controls.RadButton.ExecuteCommand()
bei Telerik.Windows.Controls.RadButton.OnClick()
bei Bdl.DialogCrm.Silverlight.Core.BDLControls.BDLButton.OnClick()
bei System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
bei System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
bei MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
I looked a the code and I assume, that the Dispose() method ofthe RadAutoCompleteBox was executed and the AutocompleteHelper is null at this moment and should be checked before accessing.
we get a NullReferenceException, when closing a dialog with a RadAutoCompleteBox.
On closing the dialog we call our Dispose() method in the viewmodel, which clears all collections (also the one which is bound to the ItemsSource of the RadAutoCompleteBox). This will result in a NullReferenceException.
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
StackTrace:
bei Telerik.Windows.Controls.RadAutoCompleteBox.OnItemsSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
bei System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
bei System.Collections.ObjectModel.ObservableCollection`1.ClearItems()
bei System.Collections.ObjectModel.Collection`1.Clear()
bei Bdl.DialogCrm.Silverlight.ViewModels.ImportManagerViewModel.Dispose()
bei Bdl.DialogCrm.Silverlight.Core.ViewManagement.Bases.ContainerViewModelBase`1.ExecuteCloseViewInstance(ViewInstanceDescription desc)
bei Bdl.DialogCrm.Silverlight.ViewModels.MainViewModel.ExecuteCloseViewInstance(ViewInstanceDescription desc)
bei Microsoft.Practices.Prism.Commands.DelegateCommand`1.<>c__DisplayClass6.<.ctor>b__2(Object o)
bei Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter)
bei Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
bei Telerik.Windows.Controls.RadButton.ExecuteCommand()
bei Telerik.Windows.Controls.RadButton.OnClick()
bei Bdl.DialogCrm.Silverlight.Core.BDLControls.BDLButton.OnClick()
bei System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
bei System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
bei MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
private void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { string searchText = this.SearchText; this.autoCompleteHelper.Populate(searchText); }I looked a the code and I assume, that the Dispose() method ofthe RadAutoCompleteBox was executed and the AutocompleteHelper is null at this moment and should be checked before accessing.
private void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e){ string searchText = this.SearchText; if (this.autoCompleteHelper != null) { this.autoCompleteHelper.Populate(searchText); }}