Rubberduck: Null Refrence Exception when tabbing in Add/Remove Refrences and related issues.

Created on 11 Aug 2020  路  5Comments  路  Source: rubberduck-vba/Rubberduck

Rubberduck version information

Version 2.5.0.5524
OS: Microsoft Windows NT 10.0.18362.0, x64
Host Product: Microsoft Office 2016 x64
Host Version: 16.0.5026.1000
Host Executable: EXCEL.EXE

Description
When pressing the tab key after preforming a search in Add/Remove references a "Null Reference" error occurs. Pressing tab in other locations will also cause this error. Also, when pressing ENTER while the cursor is in the search textbox closes the references Dialogue.

To Reproduce
Reproduce Null refrence when tabbing:

  • Open a fresh instance of the Rubberduck Add/Remove reference tool.
  • Click Directly into the search textbox Do not click into the list view.
  • Then press TAB. The error dialogue pops up with the null reference.
  • Press the continue button on the error dialogue.
  • Press tab again: Null Refrence: Continue
  • Pressing Tab the third and fourth time works as expected.
  • Pressing tab and continue the the 5th and 6th time will cause null refrence each time.
  • Tabs 7 -18 work as expected. That's when the tab order rolls over and and the null refrences will start over.
  • Close instance of dialogue
  • Related to this. IF the steps are preformed above but enter is pressed insted of tab the dialogue closes.

Prevent Null Refence when tabbing: (But illustrates another problem.)

  • Open a new instance of the Add/Remove refrence dialogue.
  • Click any item but the top item in both the left and right list boxes.
  • (The first item will work also but choosing another item is more illustrative.)
  • Now click into the search dialogue and press tab 18 time and it works as expceted.
  • There is not initial set to the items in the list boxes.
  • Notice when tabbing form the search box to the list box that the item that was initally selected in the left list box is the item that that is tabbed to. This is the same for tabbing to the right list box.

To Break it again:

  • In the same instance click in the search box.
  • Preform a search where the refrence that was choosen the the previous example is no longer shown in the list box.
  • Press tab the null refrence is back. Again for the first 2 tabs in the sequence.

Expected behavior
No null refrence when tabbing, and Dialogue does not close unexpectially when pressing enter. Also it should jump to the first itme in the list no an itme tath was previous selected.

Exception Text

System.NullReferenceException: Object reference not set to an instance of an object.
   at Rubberduck.UI.AddRemoveReferences.AddRemoveReferencesWindow.ListView_SynchronizeCurrentSelection_OnGotFocus(Object sender, RoutedEventArgs e) in C:\projects\rubberduck\Rubberduck.Core\UI\AddRemoveReferences\AddRemoveReferencesWindow.xaml.cs:line 24
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.FrameworkElement.OnGotFocus(RoutedEventArgs e)
   at System.Windows.UIElement.IsFocused_Changed(DependencyObject d, 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(DependencyPropertyKey key, Object value)
   at System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, 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.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value)
   at System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(DependencyObject focusTarget)
   at System.Windows.FrameworkElement.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
   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.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
   at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
   at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
   at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
   at System.Windows.UIElement.Focus()
   at System.Windows.Input.KeyboardNavigation.Navigate(DependencyObject currentElement, TraversalRequest request, ModifierKeys modifierKeys, DependencyObject firstElement, Boolean fromProcessInputTabKey)
   at System.Windows.Input.KeyboardNavigation.Navigate(DependencyObject sourceElement, Key key, ModifierKeys modifiers, Boolean fromProcessInput)
   at System.Windows.Input.KeyboardNavigation.ProcessInput(InputEventArgs inputEventArgs)
   at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   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.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)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
Rubberduck
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.dll
----------------------------------------
NLog
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.10.8381
    CodeBase: file:///C:/ProgramData/Rubberduck/NLog.DLL
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.ServiceModel
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel/v4.0_4.0.0.0__b77a5c561934e089/System.ServiceModel.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
Rubberduck.VBEditor
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.VBEditor.DLL
----------------------------------------
Rubberduck.Core
    Assembly Version: 2.5.0.0
    Win32 Version: 2.5.0
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.Core.DLL
----------------------------------------
Rubberduck.VBEditor.VB6
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.VBEditor.VB6.DLL
----------------------------------------
Rubberduck.VBEditor.VBA
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.VBEditor.VBA.DLL
----------------------------------------
System.ValueTuple
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ValueTuple/v4.0_4.0.0.0__cc7b13ffcd2ddd51/System.ValueTuple.dll
----------------------------------------
EasyHook
    Assembly Version: 2.7.6684.0
    Win32 Version: 2.7.6684.0
    CodeBase: file:///C:/ProgramData/Rubberduck/EasyHook.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4150.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Rubberduck.SettingsProvider
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.SettingsProvider.DLL
----------------------------------------
WindowsBase
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
Rubberduck.Resources
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.Resources.DLL
----------------------------------------
PresentationFramework
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
PresentationCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Rubberduck.Resources.resources
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/cs/Rubberduck.Resources.resources.DLL
----------------------------------------
Rubberduck.Resources.resources
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/de/Rubberduck.Resources.resources.DLL
----------------------------------------
Rubberduck.Resources.resources
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/es/Rubberduck.Resources.resources.DLL
----------------------------------------
Rubberduck.Resources.resources
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/fr/Rubberduck.Resources.resources.DLL
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
Castle.Windsor
    Assembly Version: 4.0.0.0
    Win32 Version: 4.1.0
    CodeBase: file:///C:/ProgramData/Rubberduck/Castle.Windsor.DLL
----------------------------------------
Castle.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.2.1
    CodeBase: file:///C:/ProgramData/Rubberduck/Castle.Core.DLL
----------------------------------------
Rubberduck.Parsing
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.Parsing.DLL
----------------------------------------
Rubberduck.UnitTesting
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.UnitTesting.DLL
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
office
    Assembly Version: 15.0.0.0
    Win32 Version: 15.0.4613.1000
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/office/15.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------
Rubberduck.Interaction
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.Interaction.DLL
----------------------------------------
Rubberduck.SmartIndenter
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.SmartIndenter.DLL
----------------------------------------
Antlr4.Runtime
    Assembly Version: 4.6.0.0
    Win32 Version: 4.6.4.0
    CodeBase: file:///C:/ProgramData/Rubberduck/Antlr4.Runtime.DLL
----------------------------------------
Rubberduck.CodeAnalysis
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.CodeAnalysis.DLL
----------------------------------------
Rubberduck.Refactorings
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.Refactorings.dll
----------------------------------------
Rubberduck.JunkDrawer
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.JunkDrawer.dll
----------------------------------------
Rubberduck.RegexAssistant
    Assembly Version: 2.5.0.5524
    Win32 Version: 2.5.0.5524
    CodeBase: file:///C:/ProgramData/Rubberduck/Rubberduck.RegexAssistant.dll
----------------------------------------
System.Xaml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
----------------------------------------
System.Windows.Interactivity
    Assembly Version: 4.0.0.0
    Win32 Version: 2.0.20525.0
    CodeBase: file:///C:/ProgramData/Rubberduck/System.Windows.Interactivity.DLL
----------------------------------------
ICSharpCode.AvalonEdit
    Assembly Version: 5.0.3.0
    Win32 Version: 5.0.3.0
    CodeBase: file:///C:/ProgramData/Rubberduck/ICSharpCode.AvalonEdit.DLL
----------------------------------------
System.Net.Http
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
System.Collections.Immutable
    Assembly Version: 1.2.3.0
    Win32 Version: 4.6.26515.06
    CodeBase: file:///C:/ProgramData/Rubberduck/System.Collections.Immutable.DLL
----------------------------------------
System.Runtime
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
DynamicProxyGenAssembly2
    Assembly Version: 0.0.0.0
    Win32 Version: 4.2.1
    CodeBase: file:///C:/ProgramData/Rubberduck/Castle.Core.dll
----------------------------------------
DynamicProxyGenAssembly2
    Assembly Version: 0.0.0.0
    Win32 Version: 4.2.1
    CodeBase: file:///C:/ProgramData/Rubberduck/Castle.Core.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
WindowsFormsIntegration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4150.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsFormsIntegration/v4.0_4.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
Infralution.Localization.Wpf
    Assembly Version: 3.3.0.0
    Win32 Version: 3.3.0.0
    CodeBase: file:///C:/ProgramData/Rubberduck/Infralution.Localization.Wpf.dll
----------------------------------------
System.Web
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4075.0 built by: NET48REL1LAST
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
System.Resources.ResourceManager
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Resources.ResourceManager/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Resources.ResourceManager.dll
----------------------------------------
System.Runtime.InteropServices
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.InteropServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.InteropServices.dll
----------------------------------------
PresentationFramework.Aero
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
----------------------------------------
PresentationFramework.Aero2
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero2/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero2.dll
----------------------------------------
PresentationFramework-SystemData
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemData/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemData.dll
----------------------------------------
Microsoft.CSharp
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
----------------------------------------
System.Dynamic
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll
----------------------------------------
PresentationFramework-SystemXmlLinq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXmlLinq/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXmlLinq.dll
----------------------------------------
PresentationFramework-SystemXml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXml/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXml.dll
----------------------------------------
PresentationFramework-SystemCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemCore/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemCore.dll
----------------------------------------
GongSolutions.WPF.DragDrop
    Assembly Version: 1.1.0.0
    Win32 Version: 1.1.0.0
    CodeBase: file:///C:/ProgramData/Rubberduck/GongSolutions.WPF.DragDrop.DLL
----------------------------------------
SMDiagnostics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/SMDiagnostics/v4.0_4.0.0.0__b77a5c561934e089/SMDiagnostics.dll
----------------------------------------
System.ServiceModel.Internals
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel.Internals/v4.0_4.0.0.0__31bf3856ad364e35/System.ServiceModel.Internals.dll
----------------------------------------
CustomMarshalers
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/CustomMarshalers/v4.0_4.0.0.0__b03f5f7f11d50a3a/CustomMarshalers.dll
----------------------------------------
stdole
    Assembly Version: 7.0.3300.0
    Win32 Version: 7.00.9466
    CodeBase: file:///C:/WINDOWS/assembly/GAC/stdole/7.0.3300.0__b03f5f7f11d50a3a/stdole.dll
----------------------------------------
System.Dynamic.DynamicAssembly
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll
----------------------------------------
HtmlAgilityPack
    Assembly Version: 1.8.4.0
    Win32 Version: 1.8.4
    CodeBase: file:///C:/ProgramData/Rubberduck/HtmlAgilityPack.DLL
----------------------------------------
UIAutomationTypes
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationTypes/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll
----------------------------------------
UIAutomationProvider
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationProvider/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Management
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
Windows.UI
    Assembly Version: 255.255.255.255
    Win32 Version: 10.0.10011.16384
    CodeBase: file:///C:/WINDOWS/system32/WinMetadata/Windows.UI.winmd
----------------------------------------
System.Runtime.InteropServices.WindowsRuntime
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.InteropServices.WindowsRuntime/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.InteropServices.WindowsRuntime.dll
----------------------------------------
PresentationFramework-SystemDrawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemDrawing/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemDrawing.dll
----------------------------------------
bug difficulty-01-duckling good first issue up-for-grabs

Most helpful comment

@retailcoder Hello! I've added a proposed solution, but unfortunately, I don't have a Windows machine right now and it will be difficult to implement additional unit tests, covers that. I hope it fits your expectation at least initially.

All 5 comments

Same issue also happens if when choosing the other tabs in the reference dialogue.

Wow! Thanks for this amazingly extensive report!

Looks like some temporal coupling is going on, probably code in the ViewModel making assumptions about the state of things. Without looking at the code in question, the provided stack trace makes it seem an easy fix. Obviously the ViewModel will need a number of additional unit tests, too.

Here:

https://github.com/rubberduck-vba/Rubberduck/blob/9ed85e0a1df599d03f9793ddc89b16bcb7cb7b47/Rubberduck.Core/UI/AddRemoveReferences/AddRemoveReferencesWindow.xaml.cs#L23-L27

Removing the assumption that there is a selected item should fix the NRE. Actually the fix should probably be to assign the .Text to cs?.SomeProperty ?? string.Empty.

@retailcoder moving cursor with tab doesn't select an item, so ListView.SelectedItem = null, but ListView_GotFocus Event is triggered, causing Null Reference Exception` .

As we only want to receive the selected ListView Item, it should be sufficent to use ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) Event as we are not interessered in control GotFocus, but in SelectionChange.

in Rubberduck.UI.AddRemoveReferences.AddRemoveReferencesWindow-xaml:
~xml
SelectionMode="Single"
ItemsSource="{Binding AvailableReferences}"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
SelectionChanged="ListView_SynchronizeCurrentSelection_OnSelectionChanged">
~

in Rubberduck.UI.AddRemoveReferences.AddRemoveReferencesWindow.xaml.cs:
~c#
private void ListView_SynchronizeCurrentSelection_OnSelectionChanged(object sender, RoutedEventArgs e)
~

@retailcoder Hello! I've added a proposed solution, but unfortunately, I don't have a Windows machine right now and it will be difficult to implement additional unit tests, covers that. I hope it fits your expectation at least initially.

Was this page helpful?
0 / 5 - 0 ratings