Skip to content

Commit fb752bb

Browse files
Fix test broken by autofix and use json variable in deserialize call
The Copilot Autofix commit removed the DeserializeWrapper call and Assert.IsType assertion from NonPublicProperty_JsonInclude_WorksAsExpected while leaving references to the now-undeclared 'result' local, breaking compilation. Restore the deserialize call (using the existing 'json' variable per review feedback) and the type assertion. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent f0132fe commit fb752bb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.NonPublicAccessors.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ public virtual async Task NonPublicProperty_JsonInclude_WorksAsExpected([Dynamic
366366
string json = """{"MyString":"value"}""";
367367
MemberInfo memberInfo = type.GetMember("MyString", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)[0];
368368

369+
object result = await Serializer.DeserializeWrapper(json, type);
370+
Assert.IsType(type, result);
369371
Assert.Equal("value", memberInfo is PropertyInfo p ? p.GetValue(result) : ((FieldInfo)memberInfo).GetValue(result));
370372

371373
string actualJson = await Serializer.SerializeWrapper(result, type);

0 commit comments

Comments
 (0)