Skip to content

Commit 4fedff7

Browse files
authored
Fix invalidcastexception in multivalueconditionalmap
Fix for typecast error if work item field type is not a string (e.g. integer) -> "Field map fault System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'."
1 parent 33016bf commit 4fedff7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MigrationTools.Clients.TfsObjectModel/Tools/FieldMappingTool/FieldMaps/MultiValueConditionalMap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ private bool fieldsValueMatch(Dictionary<string, string> fieldAndValues, WorkIte
7575
bool matches = true;
7676
foreach (string field in fieldAndValues.Keys)
7777
{
78-
if ((string)workitem.Fields[field].Value != fieldAndValues[field])
78+
if ((workitem.Fields[field].Value?.ToString() ?? string.Empty) != fieldAndValues[field])
7979
{
8080
matches = false;
8181
}
8282
}
8383
return matches;
8484
}
8585
}
86-
}
86+
}

0 commit comments

Comments
 (0)