Breadcrumbs added after MaximumBreadcrumbs is reached were being added from the start of the breadcrumb array, causing breadcrumbs to be added/returned in the wrong order.
Also fixes IndexOutOfRangeException and OverflowException errors when MaximumBreadcrumbs is set to a value < 1.
Design
The previous implementation was a bit over complicated. It has now been simplified, using a LinkedList instead of an Array and checking the config value before adding breadcrumbs.
Testing
Manually verified that breadcrumbs are returned in the correct order after MaximumBreadcrumbs is exceeded. Updated automated test to cover this scenario (the issue was being masked previously as the test was adding exactly double the MaximumBreadcrumbs value)
Goal
Breadcrumbs added after
MaximumBreadcrumbs
is reached were being added from the start of the breadcrumb array, causing breadcrumbs to be added/returned in the wrong order.Also fixes
IndexOutOfRangeException
andOverflowException
errors whenMaximumBreadcrumbs
is set to a value < 1.Design
The previous implementation was a bit over complicated. It has now been simplified, using a LinkedList instead of an Array and checking the config value before adding breadcrumbs.
Testing
Manually verified that breadcrumbs are returned in the correct order after MaximumBreadcrumbs is exceeded. Updated automated test to cover this scenario (the issue was being masked previously as the test was adding exactly double the
MaximumBreadcrumbs
value)