nkdAgility / azure-devops-migration-tools

Azure DevOps Migration Tools allow you to migrate Teams, Backlogs, Work Items, Tasks, Test Cases, and Plans & Suits from one Project to another in Azure DevOps / TFS both within the same Organisation, and between Organisations.
https://nkdagility.com/learn/azure-devops-migration-tools/
GNU Affero General Public License v3.0
500 stars 332 forks source link

[Bug]: Using TfsEmbededImagesTool fails with certain process template configurations #2484

Open FlexiGit opened 3 days ago

FlexiGit commented 3 days ago

Version

Source Version

Azure DevOps Service

Target Version

Azure DevOps Service

Relevant configuration

No response

Relevant log output

[16:02:47 ERR] [16.0.6] EmbededImagesRepairEnricher: Unable to fix HTML field attachments for work item *** from *** to ***
Microsoft.TeamFoundation.WorkItemTracking.WebApi.RuleValidationException: TF401320: Rule Error for field ***. Error code: Required, HasValues, AllowsOldValue, InvalidEmpty.
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<HandleResponseAsync>d__53.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__47`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__28`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MigrationTools.Tools.TfsEmbededImagesTool.UploadImageToTarget(WorkItem wi, String filePath) in C:\GitRepos\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Tools\TfsEmbededImagesTool.cs:line 199
   at MigrationTools.Tools.TfsEmbededImagesTool.UploadedAndRetrieveAttachmentLinkUrl(String matchedSourceUri, String sourceFieldName, WorkItemData targetWorkItem, String sourcePersonalAccessToken) in C:\GitRepos\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Tools\TfsEmbededImagesTool.cs:line 153
   at MigrationTools.Tools.TfsEmbededImagesTool.FixEmbededImages(WorkItemData wi, String oldTfsurl, String newTfsurl, String sourcePersonalAccessToken) in C:\GitRepos\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Tools\TfsEmbededImagesTool.cs:line 93

What happened?

Running a pretty minimal config with one of our projects, the above stacktrace appears many times in the logs.

Looking at the code, there should be an easy fix, though.

In MigrationTools.Tools.TfsEmbededImagesTool.UploadImageToTarget(WorkItem wi, String filePath) in C:\GitRepos\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Tools\TfsEmbededImagesTool.cs:line 199 you could use the bypassRules = true optional parameter, also in line 205.

Debug in Visual Studio

MrHinsh commented 3 days ago

Please submit a PR for this change.