Skip to content

Commit 468e0a9

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 2181572 commit 468e0a9

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
@@ -365,6 +365,8 @@ public virtual async Task NonPublicProperty_JsonInclude_WorksAsExpected(Type typ
365365
string json = """{"MyString":"value"}""";
366366
MemberInfo memberInfo = type.GetMember("MyString", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)[0];
367367

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

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

0 commit comments

Comments
 (0)