From 1d176c4123f95ea383b5c48b1d814e5628eaa258 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 22 Oct 2024 10:22:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(TfsWorkItemMigrationProcessor.c?= =?UTF-8?q?s):=20add=20check=20for=20field=20existence=20before=20accessin?= =?UTF-8?q?g=20'ClosedDate'=20The=20code=20now=20checks=20if=20the=20"Micr?= =?UTF-8?q?osoft.VSTS.Common.ClosedDate"=20field=20exists=20before=20attem?= =?UTF-8?q?pting=20to=20access=20it.=20This=20prevents=20potential=20runti?= =?UTF-8?q?me=20errors=20when=20the=20field=20is=20not=20present=20in=20th?= =?UTF-8?q?e=20work=20item,=20ensuring=20more=20robust=20and=20error-free?= =?UTF-8?q?=20execution.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Processors/TfsWorkItemMigrationProcessor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs b/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs index ffac27014..68d5c2e9c 100644 --- a/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs +++ b/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs @@ -419,12 +419,12 @@ private void PopulateWorkItem(WorkItemData oldWorkItemData, WorkItemData newWork } newWorkItem.Title = oldWorkItem.Title; - if (newWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].IsEditable) + if (newWorkItem.Fields.Contains("Microsoft.VSTS.Common.ClosedDate") && newWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].IsEditable) { newWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].Value = oldWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].Value; } newWorkItem.State = oldWorkItem.State; - if (newWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].IsEditable) + if (newWorkItem.Fields.Contains("Microsoft.VSTS.Common.ClosedDate") && newWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].IsEditable) { newWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].Value = oldWorkItem.Fields["Microsoft.VSTS.Common.ClosedDate"].Value; }