Skip to content

Commit c1cba4a

Browse files
[release/dev17.14] Update field value for NavBar Integration Tests (#79076)
Backport of #78553 and #78532 to release/dev17.14 /cc @phil-allen-msft @akhera99
2 parents dbc7988 + 68823cd commit c1cba4a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/EditorInProcess.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,14 @@ private async Task<List<ComboBox>> GetNavigationBarComboBoxesAsync(IWpfTextView
566566
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
567567

568568
var margin = await GetNavigationBarMarginAsync(textView, cancellationToken);
569-
return margin.GetFieldValue<List<ComboBox>>("_combos");
569+
try
570+
{
571+
return margin.GetFieldValue<List<ComboBox>>("_combos");
572+
}
573+
catch (FieldAccessException)
574+
{
575+
return margin.GetFieldValue<List<ComboBox>>("Combos");
576+
}
570577
}
571578

572579
private async Task<UIElement?> GetNavigationBarMarginAsync(IWpfTextView textView, CancellationToken cancellationToken)

src/Workspaces/CoreTestUtilities/ObjectExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static object GetFieldValue(this object instance, string fieldName)
4646

4747
if (fieldInfo == null)
4848
{
49-
throw new FieldAccessException("Field " + fieldName + " was not found on type " + type.ToString());
49+
throw new FieldAccessException($"Field '{fieldName}' was not found on type '{instance.GetType()}'");
5050
}
5151

5252
var result = fieldInfo.GetValue(instance);

0 commit comments

Comments
 (0)