bugsnag / bugsnag-dotnet

.NET notifier for BugSnag. Error monitoring and error reporting for .NET.
https://docs.bugsnag.com/platforms/dotnet/
MIT License
60 stars 29 forks source link

[PLAT-7415] - Ensure breadcrumbs are returned in the correct order #150

Closed yousif-bugsnag closed 2 years ago

yousif-bugsnag commented 3 years ago

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 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)