Refactor StringManipulator tool so it works just with string and not work item field #2548
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.
This should fix #2538
As mention id that bug report, custom user mapping is not applied during migration. @LudekStipal pointed to the code it was responsible for this. The problem is not the
StringManipulatorTool
itself, but the value which is used in that branch of code. The user mapping and all the other field mapping is done usingoldWorkItem
object, which is of typeField
. But that specific branch for strings was processed usingoldWorkItemData
object which is of typeFieldItem
. So it is the different object and for user fields, it is not working with mapped user names, because the are mapped in the other place.This is at least a bug for user fields which are mapped as @LudekStipal found. But I think, that is is also a potential source of bugs in the future, if something will be changing here. Because the one who will be changing something here may not notice, that populating work item fields it is done in different way for the strings.
StringManipulatorTool
was working withFieldItem
type. At first, I wanted to change it to work withField
type, so it would work the same way as user mapping. But this is not possible, becauseField
type is from TFS client library, butStringManipulatorTool
in in different (lower level) assembly where this is not accessible. So I changesStringManipulatorTool
that it does not take a whole field as argument, but just a string and returns new string. Basically, it does what it name suggests – takes a plain string, manipulates it and returns a new string. It was used only in this one place.This may be a breaking change. The potential problem may be, than
FieldItem
was modified byStringManipulatorTool
until now and now it remains the same. I am not sure if this can be a real issue.