Fix Activity.Baggage items Order#42659
Merged
tarekgh merged 3 commits intodotnet:masterfrom Sep 24, 2020
Merged
Conversation
noahfalk
reviewed
Sep 24, 2020
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Outdated
Show resolved
Hide resolved
Member
Author
|
@noahfalk I have addressed your feedback. please let me know if you have any more feedback. |
Member
Author
|
/backport to release/5.0 |
Contributor
|
Started backporting to release/5.0: https://github.com/dotnet/runtime/actions/runs/271504744 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #42596
In pre 5.0 .NET versions, when calling
Activity.AddBaggage, will add a new Baggage item to internal linked list. The list was LIFO, which means when callingActivity.Baggageit will return the list in the reverse order of the added items. Also,Activity.AddBaggageallow adding 2 items with same key and when callingActivity.GetBaggageItemto get a Baggage item value for a key which has duplication in the list, the API will return the last added item with that key.In 5.0, we used the internal LinkedList for other new scenarios (e.g. AddEvent) which required to have the list maintained on the order of the input. This had a side effect on
Baggageorder. The Baggage order became FIFO. Also, affectedActivity.GetBaggageItemwhich made it to return the first added item with the specified input key instead of last added items.This is important to fix because
Baggageis intended to be serialized over the wire across the process/machine. Looks users assumed specific order of the list even we didn't document the behavior. The change here is to ensure the old behavior to avoid breaking anyone and allow services using different version of theSystem.Diagnostics.DiagnosticSourceto communicate reliably through serializing/deserializing the Baggage list.