navferty / NavfertyExcelAddIn

Common tools for MS Excel
MIT License
49 stars 6 forks source link

NullReferenceException on highlight duplicates if whole list is selected #58

Closed navferty closed 4 years ago

navferty commented 4 years ago

Describe the bug NullReferenceException on highlight duplicates if whole list is selected.

To Reproduce Steps to reproduce the behavior:

  1. Open new workbook
  2. Fill some cells with values
  3. Click "Highlight Duplicates"
  4. See error

image

Additional context

Logs:

2020-06-08 21:59:54.9500 DEBUG Ribbon loaded
2020-06-08 22:00:07.4959 DEBUG HighlightDuplicates. Range selected is $1:$1048576
2020-06-08 22:00:07.6599 ERROR System.NullReferenceException: Object reference not set to an instance of an object.
   at NavfertyExcelAddIn.WorksheetCellsEditing.DuplicatesHighlighter.<>c.<ExtractDuplicates>b__2_0(Range x) in C:\Users\navfe\source\repos\NavfertyExcelAddIn\NavfertyExcelAddIn\WorksheetCellsEditing\DuplicatesHighlighter.cs:line 37
   at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.GroupedEnumerable`3.GetEnumerator()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at NavfertyExcelAddIn.WorksheetCellsEditing.DuplicatesHighlighter.ExtractDuplicates(IEnumerable`1 cells) in C:\Users\navfe\source\repos\NavfertyExcelAddIn\NavfertyExcelAddIn\WorksheetCellsEditing\DuplicatesHighlighter.cs:line 36
   at NavfertyExcelAddIn.WorksheetCellsEditing.DuplicatesHighlighter.HighlightDuplicates(Range range) in C:\Users\navfe\source\repos\NavfertyExcelAddIn\NavfertyExcelAddIn\WorksheetCellsEditing\DuplicatesHighlighter.cs:line 22
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at NavfertyExcelAddIn.Commons.ExceptionLogger.Intercept(IInvocation invocation) in C:\Users\navfe\source\repos\NavfertyExcelAddIn\NavfertyExcelAddIn\Commons\ExceptionLogger.cs:line 27