Repository: dotnet/roslyn
File: src/Workspaces/CoreTest/FindReferencesTests.cs (C#)

Code before:

        var innerCLocations = innerCReferences[0].Locations.Where(loc => !loc.IsImplicit).ToList();
        Assert.Equal(1, innerCLocations.Count); // Should only have the assignment usage, not declaration

        var innerCUsage = innerCLocations.Single();

        // CRITICAL TEST: In "InnerC.Field = 5", InnerC should be READ (not written)
        // This is the key assertion - in a.b.c = 5, 'b' (InnerC) is read to access 'c' (Field)
        Assert.True(innerCUsage.SymbolUsageInfo.IsReadFrom(), 
            "InnerC should be READ in 'InnerC.Field = 5'. " +
            $"The walk-up logic should not affect this. UsageInfo: {innerCUsage.SymbolUsageInfo}");

        Assert.False(innerCUsage.SymbolUsageInfo.IsWrittenTo(), 
            "InnerC should NOT be WRITTEN in 'InnerC.Field = 5'. " +
            $"Only Field should be written. UsageInfo: {innerCUsage.SymbolUsageInfo}");

        // Verify Field is written as expected
        var fieldReferences = (await SymbolFinder.FindReferencesAsync(fieldSymbol, solution)).ToList();
        Assert.Equal(1, fieldReferences.Count);

        var fieldLocations = fieldReferences[0].Locations.Where(loc => !loc.IsImplicit).ToList();
        Assert.Equal(1, fieldLocations.Count); // Should only have the assignment usage, not declaration

        var fieldUsage = fieldLocations.Single();

        Assert.True(fieldUsage.SymbolUsageInfo.IsWrittenTo(), 
            "Field should be WRITTEN in 'InnerC.Field = 5'. " +
            $"UsageInfo: {fieldUsage.SymbolUsageInfo}");
    }

    private static void Verify(ReferencedSymbol reference, HashSet<int> expectedMatchedLines)
    {
        void verifier(Location location)
        {
            var line = location.GetLineSpan().StartLinePosition.Line;
            Assert.True(expectedMatchedLines.Remove(line), $"An unexpected reference was found on line number {line}.");
        }

        foreach (var location in reference.Locations)
        {
            verifier(location.Location);
        }

        foreach (var location in reference.Definition.Locations)
        {
            verifier(location);
        }
    }
}


Review comment (suggestion):
```suggestion
        Assert.True(fieldUsage.SymbolUsageInfo.IsWrittenTo(),
```

Code after:

        var innerCLocations = innerCReferences[0].Locations.Where(loc => !loc.IsImplicit).ToList();
        Assert.Equal(1, innerCLocations.Count); // Should only have the assignment usage, not declaration

        var innerCUsage = innerCLocations.Single();

        // CRITICAL TEST: In "InnerC.Field = 5", InnerC should be READ (not written)
        // This is the key assertion - in a.b.c = 5, 'b' (InnerC) is read to access 'c' (Field)
        Assert.True(innerCUsage.SymbolUsageInfo.IsReadFrom(),
            "InnerC should be READ in 'InnerC.Field = 5'. " +
            $"The walk-up logic should not affect this. UsageInfo: {innerCUsage.SymbolUsageInfo}");

        Assert.False(innerCUsage.SymbolUsageInfo.IsWrittenTo(),
            "InnerC should NOT be WRITTEN in 'InnerC.Field = 5'. " +
            $"Only Field should be written. UsageInfo: {innerCUsage.SymbolUsageInfo}");

        // Verify Field is written as expected
        var fieldReferences = (await SymbolFinder.FindReferencesAsync(fieldSymbol, solution)).ToList();
        Assert.Equal(1, fieldReferences.Count);

        var fieldLocations = fieldReferences[0].Locations.Where(loc => !loc.IsImplicit).ToList();
        Assert.Equal(1, fieldLocations.Count); // Should only have the assignment usage, not declaration

        var fieldUsage = fieldLocations.Single();

        Assert.True(fieldUsage.SymbolUsageInfo.IsWrittenTo(),
            "Field should be WRITTEN in 'InnerC.Field = 5'. " +
            $"UsageInfo: {fieldUsage.SymbolUsageInfo}");
    }

    private static void Verify(ReferencedSymbol reference, HashSet<int> expectedMatchedLines)
    {
        void verifier(Location location)
        {
            var line = location.GetLineSpan().StartLinePosition.Line;
            Assert.True(expectedMatchedLines.Remove(line), $"An unexpected reference was found on line number {line}.");
        }

        foreach (var location in reference.Locations)
        {
            verifier(location.Location);
        }

        foreach (var location in reference.Definition.Locations)
        {
            verifier(location);
        }
    }
}